Re: [R] creating a dynamic output vector

2007-11-08 Thread Greg Snow
ECTED] On Behalf Of Steve Powers > Sent: Wednesday, November 07, 2007 4:42 PM > To: Peter Alspach > Cc: r-help@r-project.org > Subject: Re: [R] creating a dynamic output vector > > Not exactly. That doesn't work for me. Because I don't > actually know what variables are c

Re: [R] creating a dynamic output vector

2007-11-07 Thread Ben Bolker
Steve Powers wrote: > > Not exactly. That doesn't work for me. Because I don't actually know > what variables are created each time I run the program, I don't have an > easy way to call all the ones I need at once (which your suggestion > appears to require). But I do have a list of names fo

Re: [R] creating a dynamic output vector

2007-11-07 Thread Rolf Turner
On 8/11/2007, at 3:00 PM, Steve Powers wrote: > Everyone is assuming I know what the output data are, or that they > come > out from my model in some easily called vector. But I don't, and > they do > not. The outputs are hidden, and all are separate variables that > need to > be called. Al

Re: [R] creating a dynamic output vector

2007-11-07 Thread jim holtman
Here is a script that will find all the atomic objects of length 1 and put them in a dataframe that you then use to determine what variables are there. > a <- 1 # generate some atomic objects > b <- 1.3 > x.char <- "character string" > x.log <- TRUE > x.real <- pi > # get all atomic objects of l

Re: [R] creating a dynamic output vector

2007-11-07 Thread Steve Powers
Everyone is assuming I know what the output data are, or that they come out from my model in some easily called vector. But I don't, and they do not. The outputs are hidden, and all are separate variables that need to be called. Also which ones come out after a given run will vary each time. Al

Re: [R] creating a dynamic output vector

2007-11-07 Thread jim holtman
Here is a function that might do what you want: > # function to create the output > f.output <- function(dat){ + # create the base output vector + output.base <- rep(NA,10) + names(output.base) <- paste("var", 1:10, sep='') + output.base[names(dat)] <- dat + output.base + } > >

Re: [R] creating a dynamic output vector

2007-11-07 Thread Bert Gunter
y, November 07, 2007 2:41 PM To: Steve Powers; r-help@r-project.org Subject: Re: [R] creating a dynamic output vector Steve Is this the sort of thing you mean? output <- character(26) names(output) <- paste('var', LETTERS[1:26], sep='') output output[paste('var'

Re: [R] creating a dynamic output vector

2007-11-07 Thread Steve Powers
Not exactly. That doesn't work for me. Because I don't actually know what variables are created each time I run the program, I don't have an easy way to call all the ones I need at once (which your suggestion appears to require). But I do have a list of names for all the variables I want. We ne

Re: [R] creating a dynamic output vector

2007-11-07 Thread Peter Alspach
Steve Is this the sort of thing you mean? output <- character(26) names(output) <- paste('var', LETTERS[1:26], sep='') output output[paste('var', LETTERS[c(2,4,6,7,16)], sep='')] <- c(1, pi, letters[1:3]) output Peter Alspach > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[E