[R] How to select a whole column? Thanks!

Paul Lemmens
2004-08-03T08:58:49Z

Hoi Jinsong,

--On dinsdag 3 augustus 2004 1:42 -0700 Jinsong Zhao <jinsong_zh at
yahoo.com>
wrote:
> For instance, I hope to remove the V3~6 column, for all the value in
> those colume is zero.
>
>   V3 V4 V5 V6     V7     V8     V9    V10
> 1  0  0  0  0  0.000  0.000  0.000  0.000
> 2  0  0  0  0  0.000  0.000  0.000  0.000
> 3  0  0  0  0  0.000  0.000  0.000  0.000
> 4  0  0  0  0  0.000  0.000  0.000  0.000
> 5  0  0  0  0  0.000  0.000  0.000  0.000
> 6  0  0  0  0 -0.001 -0.001 -0.001 -0.001
> 7  0  0  0  0  0.000  0.000  0.000 -0.001
> 8  0  0  0  0  0.000  0.000  0.000 -0.001
> 9  0  0  0  0 -0.009 -0.012 -0.015 -0.018
>
> I mean how to select the first four columns.
>
subset(df, select=-c(V3,V4,V5,V6))



--
Paul Lemmens
NICI, University of Nijmegen              ASCII Ribbon Campaign /"\
Montessorilaan 3 (B.01.05)                    Against HTML Mail \ /
NL-6525 HR Nijmegen                                              X
The Netherlands                                                 / \
Phonenumber    +31-24-3612648
Fax            +31-24-3616066