Re: [R] How to extract range of colums in a data frame

2009-01-04 Thread Marc Schwartz
Or this: new.DF <- subset(dat, select = V3:V9) > str(new.DF) 'data.frame': 16 obs. of 7 variables: $ V3: num 9 18 15 15 21 21 12 15 21 19.5 ... $ V4: int 18 8 8 6 21 21 21 9 21 18 ... $ V5: num 12 12 12 18 21 ... $ V6: num 18 18 12 6 21 21 21 18 21 19.5 ... $ V7: num 15 15 18 18 21 2

Re: [R] How to extract range of colums in a data frame

2009-01-04 Thread stephen sefick
x <- dat[,3:9] # I think this is what you want. On Sun, Jan 4, 2009 at 9:42 PM, Jorge Ivan Velez wrote: > Dear Gundala, > Try this: > >> ex<-paste("V",3:9,sep="") >> new.dat<-dat[,ex] >> new.dat > > HTH, > > Jorge > > > > On Sun, Jan 4, 2009 at 9:36 PM, Gundala Viswanath wrote: > >> Dear all, >>

Re: [R] How to extract range of colums in a data frame

2009-01-04 Thread Jorge Ivan Velez
Dear Gundala, Try this: > ex<-paste("V",3:9,sep="") > new.dat<-dat[,ex] > new.dat HTH, Jorge On Sun, Jan 4, 2009 at 9:36 PM, Gundala Viswanath wrote: > Dear all, > > I have the following data frame: > > > dat > V1 V2 V3 V4V5 V6 V7 V8 V9 > 1 1