Hello,
I have the following question:

when creating a data.frame
 a1<-c(1,2,3)
 a2<-c(1,2,3)
 c<-data.frame(a1,a2)
I can select columns using an index like:
c[,1:2]
Is this possible too when using column-names? (something like c(,"a1":"a2"),
which doesn't work)

Alternative question: Is there a function to get the index of a variable by
name or can I
select certain columns using a loop? (a_1, a_2, ..., a_n)

Thank you very much!
David

        [[alternative HTML version deleted]]

______________________________________________
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 commented, minimal, self-contained, reproducible code.

Reply via email to