[R] Alternative to list()
Ko-Kang@xtra.co.nz
Ko-Kang at xtra.co.nz
Thu Mar 15 07:33:33 CET 2001
Hi,
Suppose I have a dataset with 10 columns, let's call it "foo".
Now if I want to extract out only column 2 ~ 8, then I know I can use either:
foo[ ,2:8]
or
fooNew <- list( foo[ ,2:8] )
(Is there any other alternative, just out of curiosity?)
But, if I only want, say, column 1, 4 and 7, I tried:
fooNew <- list( x = foo[ ,1], y = foo[ ,4], z = foo[ , 7] )
then when I type
fooNew
I got a list of:
$x
....
....
$y
....
....
$z
....
....
However what I really want is for them to be in vector/column form. How would I do this?
Thanks in advance!
Kevin
-------------------------------------------------
Ko-Kang Kevin Wang
Statistical Analysis Division Leader
Software Developers' Klub
University of Auckland
New Zealand
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://stat.ethz.ch/pipermail/r-help/attachments/20010315/569789bb/attachment.html
More information about the R-help
mailing list