similar to: save ordinary numerical calculations as pdf

Displaying 20 results from an estimated 1000 matches similar to: "save ordinary numerical calculations as pdf"

2010 Aug 24
3
multiple assignments ?
Simple one, have read and googled, still no luck! I want to create several empty vectors all of the same length. I would like multiple empty vectors (vec1, vec2, vec3) and want to create them all in one line. I've tried vec1,vec2,vec3 <- vector(length=5) and c(vec1,vec2,vec3) <- vector(length=5) and several other attempts but nothing seems to work ... suggestions? Thanks Jim
2010 Oct 20
2
create a list fails
I can not understand why this fails > > faicoutput2 <- list(stuff21 = as.numeric(faicout$coefficients[2]), + stuff31=as.numeric(faicout$coefficients[3]), + stuff41=as.numeric(faicout$coefficients[4]), + stuff32=(stuff21-stuff31), + stuff42=(stuff21-stuff41), +
2010 Aug 31
4
pasting together 2 character arrays
If possible I would like to combine two different character arrays in combinations Array1 <- c("height","weight","age","sex") Array2 <- c("trt0","trt1","trt2") I would like to combine these two character vectors to end up with such ... Array3 "height.trt0.trt1" "height.trt0.trt2"
2011 Feb 17
7
removing lower and upper quantiles from an arry
I'm trying to work out the simplest way to remove the upper and lower quantiles, in this case upper and lower 25% from an array. I can do it in two steps but when I try it in one, it fails. Is there something simple missing from my syntax or are there other simple elegant way to accomplish this? Thanks J > i <-1:20 > i2 <- i[i<quantile(i,.75)] > i3 <-
2011 Mar 14
7
creating character vector
Is there a way to convince R to create a character vector without using the quotes? This works ex1 <- c("first","second") but when I try this it doesn't ext <- as.character(c(first,second)) it complains. I have many variables to put into character vectors so dispensing with the quotes would be useful. Thanks Jim =============================== Dr. Jim Maas
2010 Sep 16
5
using variable from for loop in naming new variables
Simple one here ... but can't get it to work ... for (i in 1:4){ paste("stuff",[i]),sep="") <- 3 + i } ls() rm(list=ls()) I just want it to create 4 new variables called stuff1, stuff2, stuff3, stuff4 with the corresponding assignments. I realise that there are more elegant functions but this is just a model of a bigger situation. Thanks Jim
2011 Feb 18
6
sort a 3 dimensional array across third dimension ?
I'm attempting to sort a 3 dimensional array that looks like this > x , , 1 [,1] [,2] [1,] 9 9 [2,] 7 9 , , 2 [,1] [,2] [1,] 6 5 [2,] 4 6 , , 3 [,1] [,2] [1,] 2 1 [2,] 3 2 Such that it ends up like this .... > y , , 1 [,1] [,2] [1,] 2 1 [2,] 3 2 , , 2 [,1] [,2] [1,] 6 5 [2,] 4 6 , , 3 [,1] [,2]
2011 Jul 06
1
elegant way of removing NA's and selecting specific values from a data.frame
I have a data.frame "e" and would like to extract the 23rd column, remove any NA's and then remove any values >= 30. I can do it in steps such as this but have failed to figure out how to do it in a single line .... any suggestions? first <- e[,23] second <- first[!is.na(first)] third <- second[second<=30] thanks a bunch J -- Dr. Jim Maas University of East
2010 Nov 09
1
jags error message
Could anyone give me some clues as to the best way to debug this error message? I think it is from the passing of variables back to R from the jags function which does Bayesian fitting. The curious part for me is that the error messages seem random, yet the input data are always the same. Any suggestions most welcome. Thanks J Compiling model graph Resolving undeclared variables
2010 Nov 10
1
external R scripts
Is it possible to send data from an executing R script, to external R script files, on linux in this case, get that external R script to execute, and pass results back to the central script? If so what commands should I be looking at? I've googled for R and external, stuff like that but no luck. The reason for the question is that I need to generate simulation data, then perform several
2011 Jan 19
1
combining matrices from a list into a multidimensional array
I get some results back from running an iterative analysis in the form of a list of matrices. What I would like to do with this list is combine it such that all the similar components get combined into a multidimensional array. If possible I'd like to put results[[1]]$resultmean and results[[2]]$resultmean into a 3x3x2 array, and also put results[[1]]$resultsd and results[[2]]$resultsd in a
2011 Jan 20
1
syntax for a list of components from a list
I'm attempting to generalise a function that reads individual list components, in this case they are matrices, and converts them into 3 dimensional array. I can input each matrix individually, but want to do it for about 1,000 of them ... This works array2 <- abind(list1[[1]],list1[[2]],list1[[3]],along=3) This doesn't array2 <- abind(list1[[1:3]],along=3) This doesn't either
2011 Jan 30
1
Error in { : task 3 failed - "NA/NaN argument"
I'm attempting to run a rather complex routine that involves a few loops, and even some use of foreach and doMPI. I just added another external loop and now get this error message. Error in { : task 3 failed - "NA/NaN argument" Is there a way to debug what is causing this error or where? I really have no idea what "task 3" is? Thanks Jim
2011 Sep 01
1
cannot correct step size, geweke.diag of coda
Intermittently I'm getting this error from the geweke.diag function of the coda package. Would anyone be kind enough to enlighten me as to the possible source of such an error, or how to debug/locate it? Error in { : task 22 failed - "inner loop 1; cannot correct step size" Thanks a bunch. J -- Dr. Jim Maas University of East Anglia
2011 Apr 10
2
howto calculate column means in data frame
Long story short, I have a big iterative procedure that produces a long list of data.frames such as the one called "results" here. Is there an easy way to produce a similar list of data.frames comprised of the mean of each of the columns in results, such that it ends up like the one I've shown in "resultsmean" below? I've tried apply and lapply, still not got the
2011 Feb 17
2
does range of values in array include a third value?
I'm using the range command to get the minimum and maximum values of an array as in x <- range(array_y) which gives me two values such as [1] -2 9 I need to be able to test if this range of values includes a third value. For example I'd like to query 1) does the range of -2 to 9 include 3, answer TRUE 2) does the range of -2 to 9 include -6, answer FALSE? All values could be
2010 Dec 15
3
calculating mean of list components
I get a list object from an iterative function. I'm trying to figure out the most efficient way to calculate the mean of one element, across all components of the overall list. I've tried output <- mean (listobject[[1:5]]$element) to get the mean of "element" in the first five components? It doesn't like the $. I'm suspect one of the "apply" functions
2010 Aug 20
2
output values from within a function
Is it possible to get R to output the value of an expression, that is being calculated within a function? I've attached a very simple example but for more complicated ones would like to be able to debug by seeing what the value of specific expressions are each time it cycles through a loop that executes the expression. I'm relatively new to this so there may be much simpler more elegant
2011 May 17
1
extract value from mer object ?
What is the easiest way to extract a value from a 'mer' object from glmer? The first I need is the trtpair Std.Dev. which in this case is 0.17542? I've managed to get the fixed effects numbers from summary(fednmaout)@coeffs but no luck with the Random effects stuff. TIA Jim > fednmaout Linear mixed model fit by REML Formula: lor ~ as.factor(t2) + as.factor(t3) + (1 |
2010 Aug 18
2
combinations
I would appreciate any suggestions on which function to use to write subsequent functions analysing combinations of treatments. This refers to experimental trials of medical treatments. I want to write routines to analyse various comparisons (combinations) So .... if 5 treatments are available (t01, t02, t03, t04 and t05) I want to write a general routine that works out all possible