[R] character substitution within a variable name

matric matteo.richiardi at gmail.com
Wed Nov 23 20:29:03 CET 2011

I'd like to create a function that accepts as arguments a string that is to
be substituted within a variable name. For instance, suppose I have a data
frame df:


What I have in mind is something like:

f <- function(string){
var = paste("x_",string,sep = "")

which does not work. Any suggestion for modifications? Thanks in advance,

View this message in context: http://r.789695.n4.nabble.com/character-substitution-within-a-variable-name-tp4101154p4101154.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list