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 comm
t[, x[1:3]]
The results, in both cases, should be data frames
Bill Venables.
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Serguei Kaniovski
Sent: Sunday, 26 June 2011 10:01 PM
To: r-help@r-project.org
Subject: [R] Accessing var
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
3 matches
Mail list logo