Hi Olivier,

is this what you want?

x="col1 col2
1 0.1  1.1
2 0.2  1.2"

m=read.table(textConnection(x),header=TRUE)
m1=matrix(unlist(m),ncol=2)
m1
[,1] [,2]
[1,]  0.1  1.1
[2,]  0.2  1.2

HTH,

Jorge


On Thu, Apr 24, 2008 at 6:02 PM, Olivier Lefevre <[EMAIL PROTECTED]> wrote:

> Another possibly simple thing that I cannot get right is how to extract the
> data part of a list as a matrix. The data were read from xls, with labels,
> and thus are of list mode, e.g.,
>
>   col1 col2
> 1 0.1  1.1
> 2 0.2  1.2
>
> I want to extract from that just the numeric data part, i.e., (in this
> case) the same thing that matrix(c(0.1, 0.2, 1.1, 1.2), 2, 2) would return.
> I am grasping for a syntax like list[[1:2]] but that doesn't work and I
> can't find anything that does.
>
> Thanks,
>
> -- O.L.
>
> ______________________________________________
> R-help@r-project.org 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.

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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.

Reply via email to