Re: [R] How to get all the data in a specific column from a dataframe?

From: Chuck Cleland <ccleland_at_optonline.net>
Date: Sat 04 Feb 2006 - 03:08:42 EST

test_frame[,"col3"]

or

subset(test_frame, select = col3)

Vincent Deng wrote:
> Dear R-helpers:
>
> Suppose I have a datafram called "test_frame" like this
> col1 col2 col3 col4
> r1 x x x x
> r2 x x x x
> r3 x x x x
> .. x x x x
> rn x x x x
>
> I know I can get data of col3 by using test_frame[,3].
>
> My question is, if I want to do this by specifying "col3" rather than 3,
> what should I do?
>
> Many thanks....
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 452-1424 (M, W, F)
fax: (917) 438-0894

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Sat Feb 04 03:16:16 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:42:22 EST