Re: [R] how to select columns

2012-01-30 Thread Marc Schwartz
On Jan 30, 2012, at 12:33 PM, David Winsemius wrote: > > On Jan 30, 2012, at 2:30 AM, David Studer wrote: > >> 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:

Re: [R] how to select columns

2012-01-30 Thread David Winsemius
On Jan 30, 2012, at 2:30 AM, David Studer wrote: 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"), whi

Re: [R] how to select columns

2012-01-30 Thread Milan Bouchet-Valat
Le lundi 30 janvier 2012 à 08:30 +0100, David Studer a écrit : > 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? (som

[R] how to select columns

2012-01-30 Thread David Studer
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 fu