[R] variable name question
deepankar
dbasu at econs.umass.edu
Sun Oct 9 17:34:17 CEST 2011
Hi All,
This is surely an easy question but somehow I am not being able to get it.
I am using R 2.13.2 and have a data set where variable names like this
appear:
pci1990, pci1991, ... , pci2009.
"pci1990" has data on per capita income for 1990, "pci1991" has data on
per capita income for 1991, and so on.
I would like to create the logarithm of per capita for each of the year
and could do so in STATA with the following commands:
forvalues number = 1990/2009 {
gen lpci`number' = log(pci`number')
}
What would be the corresponding set of commands in R?
Thanks a lot in advance.
Deepankar
More information about the R-help
mailing list