Skip to content
Prev 17578 / 398502 Next

indexing data.frames

Dear Graham,
At 11:43 AM 3/3/2002 -0800, graham lawrence wrote:

            
If I understand correctly what you're trying to do, you want to index 
variables in a collection of data frames. I think that the natural way to 
do this in R is to use a list of data frames; e.g., using your names, index 
<- list(i1, i2, etc.). You could then access the second variable in the 
first data frame of the list as index[[1]][[2]]. Granted, the subscripts 
aren't of the form [1, 2], nor does this data structure require that the 
individual data frames be similar, but perhaps this will do what you need.

I hope that this helps,
  John
-----------------------------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada L8S 4M4
email: jfox at mcmaster.ca
phone: 905-525-9140x23604
web: www.socsci.mcmaster.ca/jfox
-----------------------------------------------------

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._