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 <smartpink111@yahoo.com> 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.
>
>
>
>
> On Tuesday, February 11, 2014 3:18 PM, Dustin Fife <fife.dustin@gmail.com>
> 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(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 to supply a string? e.g.,
>
> k = 2
> VarNames = paste0("Var", 1:k)
> paste(someFunction(VarNames), collapse="")
>
> Suppose Var1 = A, B, C and Var2 = 1, 2. The result should return A1, A2,
> B1, B2, C1, C2.
>
> I've tried using eval, and get, but with no luck. Thanks in advance!
>
> Dustin
>
>     [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>

	[[alternative HTML version deleted]]


