[R] turn string into expression for paste
gunter.berton at gene.com
Tue Feb 11 21:21:36 CET 2014
Sent from my iPhone -- please excuse typos.
> On Feb 11, 2014, at 12:15 PM, Dustin Fife <fife.dustin at 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!
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help