On 16 Sep 2011, at 1:49 AM, andrewH wrote: >> I'm trying to make a function that takes column names then >> using the variable colName, containing the name of >> the column, to refer to the column itself rmail...@justemail.net said > What am I missing about your inquiry: It seems like x[ , colName ] should > work:
I think what is being asked is to treat the value of a variable not as a string (which work fine in your example), but as a variable name In php you’d use $$ to dereference by name $whatIwant = 2 $nomdeplume = "whatIwant" $$nomdeplume 2 I’ve not come across this functionality in R: would be great if it exists ______________________________________________ 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.