[R] matrix from list

From: Olivier Lefevre <lefevrol_at_yahoo.com>
Date: Fri, 25 Apr 2008 00:02:53 +0200

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.


R-help_at_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. Received on Thu 24 Apr 2008 - 22:06:52 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 24 Apr 2008 - 22:30:33 GMT.

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

list of date sections of archive