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
> 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:[

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
t; > >> -Original Message- >> From: [EMAIL PROTECTED] >> [mailto:[EMAIL PROTECTED] On Behalf Of Steve Powers >> Sent: Thursday, 8 November 2007 11:27 a.m. >> To: r-help@r-project.org >> Subject: [R] creating a dynamic output vector >> >>

Re: [R] creating a dynamic output vector

2007-11-07 Thread Peter Alspach
al Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Steve Powers > Sent: Thursday, 8 November 2007 11:27 a.m. > To: r-help@r-project.org > Subject: [R] creating a dynamic output vector > > Let's say I have a program that returns variables who

[R] creating a dynamic output vector

2007-11-07 Thread Steve Powers
Let's say I have a program that returns variables whose names may be any string within the vector NAMES=c("varA","varB","varC","varD","varE","varF"..."varZ"), but I do not ever know which ones have actually been created. So in one example output, "varA", "varC", and "varD" could exist, but in a