Displaying 1 result from an estimated 1 matches for "gdp_w".
2011 Jun 26
2
Accessing variables in a data frame
....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
example to compute
gdp_w - gdp_i
inf_w - inf_i
unp_w - unp_i
or
gdp - gdp_w
inf - inf_w
unp - unp_w
without needing to code each difference separately?
Thanks for your help!
Serguei Kaniovski
[[alternative HTML version deleted]]