[R] Convert a string to a variable name
ligges at statistik.tu-dortmund.de
Wed Dec 7 21:06:28 CET 2011
On 07.12.2011 20:15, Jeffrey Fuerte wrote:
> I am trying to ask the user for which column their data is in, and then use
> this information in a function. So far I have:
> data<- read.csv(file.choose(), header=TRUE)
> col<- (winDialogString("Which column contains your data?",""))
> and I want to be able to reference such as:
> meas<- data$col
meas <- data[[col]]
> and use this meas in the function.
> However, I can't seem to get this to work because the input is read into a
> string, and I can't figure out how to convert this string to the vector
> name that I want.
> Any help is appreciated.
> [[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