Re: [R] question about cbind()

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Sun 20 Aug 2006 - 10:05:49 EST

First 4 colums of builtin data frame anscombe as a matrix:

  as.matrix(anscombe[1:4])

On 8/19/06, jz7@duke.edu <jz7@duke.edu> wrote:
> Dear all,
>
> I have a question about how to get a matrix by combining a large number of
> columns from a data file. Suppose I read a file which have 1000 columns
> by:
>
> test = read.table("dat.txt", header=F)
>
> I know I could use "cbind()". It's easy to do when the number of columns
> is small (i.e. cbind(test$V1, test$V2)). But how about build a matrix "X"
> by combine the first 500 columns. Is there an easy way to write the
> expression?
>
> Thanks so much!
>
> Jeny
>
> ______________________________________________
> 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
> and provide commented, minimal, self-contained, reproducible code.
>



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 and provide commented, minimal, self-contained, reproducible code. Received on Sun Aug 20 10:12:07 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sun 20 Aug 2006 - 12:21:21 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.