Re: [R] Accessing variables in a data frame

2011-06-27 Thread Serguei Kaniovski
Thanks! I did not realize you can access variables by name like this. Serguei __ 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

[R] Accessing variables in a data frame

2011-06-26 Thread Serguei Kaniovski
Hello My data.frame (dat) contains many variables named var.names and others named var.names_var.id For example var.name - c(gdp,inf,unp) var.id - c(w,i) x - paste(var.name, rep(var.id, each=length(var.name)), sep=_) How can I access variables in the dama.frame by names listed in x, for

Re: [R] Accessing variables in a data frame

2011-06-26 Thread Bill.Venables
] On Behalf Of Serguei Kaniovski Sent: Sunday, 26 June 2011 10:01 PM To: r-help@r-project.org Subject: [R] Accessing variables in a data frame Hello My data.frame (dat) contains many variables named var.names and others named var.names_var.id For example var.name - c(gdp,inf,unp) var.id - c(w,i) x