Re: [R] Howto access V-base only column in a data frame

2008-06-20 Thread Marc Schwartz
on 06/19/2008 11:28 PM Rolf Turner wrote: On 20/06/2008, at 4:07 PM, Moshe Olshansky wrote: If you know the value of k then you could do the following: goodNames - paste(V,1:k,sep=) ind - which(colnames(df) %in% goodNames) df[,ind] (where df is your dataframe). P.S. I won't be surprised if

[R] Howto access V-base only column in a data frame

2008-06-19 Thread Gundala Viswanath
Hi, Suppose I have the following data frame: V1 V2 V3 var 1 100 200 400 2.3 2 40.5 1.2 20.3 ... In this example the maximum V column is 3. In my code there the column number can be varied. My question is how can I access data frame from column V1 up to Vk (some k and excluding'var' column)?

Re: [R] Howto access V-base only column in a data frame

2008-06-19 Thread Moshe Olshansky
[EMAIL PROTECTED] wrote: From: Gundala Viswanath [EMAIL PROTECTED] Subject: [R] Howto access V-base only column in a data frame To: [EMAIL PROTECTED] Received: Friday, 20 June, 2008, 1:27 PM Hi, Suppose I have the following data frame: V1 V2 V3 var 1 100 200 400 2.3 2 40.5 1.2 20.3

Re: [R] Howto access V-base only column in a data frame

2008-06-19 Thread Rolf Turner
On 20/06/2008, at 4:07 PM, Moshe Olshansky wrote: If you know the value of k then you could do the following: goodNames - paste(V,1:k,sep=) ind - which(colnames(df) %in% goodNames) df[,ind] (where df is your dataframe). P.S. I won't be surprised if df[,goodNames] is all right too (have