On Aug 11, 2012, at 6:01 AM, Ista Zahn wrote:
On Sat, Aug 11, 2012 at 8:51 AM, Sachinthaka Abeywardana
wrote:
I should have mentioned that I do not know the number index of the
columns,
but regardless, thanks for the responses
Right, so use my first method. This does not depend on the pos
27448 5.286831 5.521572 4.036457 5.532234
#5 5.500054 6.080370 6.259925 3.946102 4.554102
Hope this helps.
A.K.
- Original Message -
From: Sachinthaka Abeywardana
To: r-help@r-project.org
Cc:
Sent: Saturday, August 11, 2012 7:59 AM
Subject: [R] choosing multiple columns
Hi all,
I hav
On Sat, Aug 11, 2012 at 8:51 AM, Sachinthaka Abeywardana
wrote:
> I should have mentioned that I do not know the number index of the columns,
> but regardless, thanks for the responses
Right, so use my first method. This does not depend on the position of
the columns.
Best,
Ista
>
>
> On Sat, A
I should have mentioned that I do not know the number index of the columns,
but regardless, thanks for the responses
On Sat, Aug 11, 2012 at 10:46 PM, Ista Zahn wrote:
> Hi Sachin,
>
> There are at least two ways. The safer way is to use a regular
> expression to find the matching columns, like
Hi Sachin,
There are at least two ways. The safer way is to use a regular
expression to find the matching columns, like this:
a <- initial_data[grep("^OFB[0-9]+", names(initial_data))]
Alternatively, if you know that the columns you want are the first 8
you can select them by position, like this
be of real help
www.et.bs.ehu.es/~etptupaf/pub/R/RforSAS&SPSSusers.pdf
John Kane
Kingston ON Canada
> -Original Message-
> From: sachin.abeyward...@gmail.com
> Sent: Sat, 11 Aug 2012 21:59:59 +1000
> To: r-help@r-project.org
> Subject: [R] choosing multiple columns
>
> H
Hi all,
I have a data frame that has the columns OFB1, OFB2, OFB3,... OFB10.
How do I select the first 8 columns efficiently without typing each and
every one of them. i.e. I want something like:
a<-data.frame(initial_data$OFB1-10) #i know this is wrong, what would be
the correct syntax?
Thanks
7 matches
Mail list logo