[R] turn string into expression for paste

2014-02-11 Thread Dustin Fife
I have a list of variables of a variable length (e.g., Var1, Var2, Var3, ... Vark). What I want to do is somehow feed that information into the paste function, like: paste(Var1, Var2, Var3...) The problem is that I don't want to hard-code it because it's wrapped within a function. Is there a way

Re: [R] turn string into expression for paste

2014-02-11 Thread Dustin Fife
do.call did it. (and I learned a new function!) Thanks for the help, everyone. On Tue, Feb 11, 2014 at 2:24 PM, arun wrote: > Hi, > May be this helps: > Var1 <- LETTERS[1:3] > Var2 <- 1:2 > do.call(paste0,expand.grid(lapply(VarNames,get))) > #[1] "A1" "B1" "C1" "A2" "B2" "C2" > A.K. > > > > >

Re: [R] turn string into expression for paste

2014-02-11 Thread arun
Hi, May be this helps: Var1 <- LETTERS[1:3]  Var2 <- 1:2  do.call(paste0,expand.grid(lapply(VarNames,get))) #[1] "A1" "B1" "C1" "A2" "B2" "C2" A.K. On Tuesday, February 11, 2014 3:18 PM, Dustin Fife wrote: I have a list of variables of a variable length (e.g., Var1, Var2, Var3, ... Vark). Wha

Re: [R] turn string into expression for paste

2014-02-11 Thread Bert Gunter
?do.call Bert Sent from my iPhone -- please excuse typos. > On Feb 11, 2014, at 12:15 PM, Dustin Fife wrote: > > I have a list of variables of a variable length (e.g., Var1, Var2, Var3, > ... Vark). What I want to do is somehow feed that information into the > paste function, like: > > paste