[R] reading matrix objects into a list
Huntsinger, Reid
reid_huntsinger at merck.com
Thu Oct 13 21:57:54 CEST 2005
Try
x <- list(A)
instead. Coercion (as.list) sees A as a vector of length 90,000 (forgetting
the "dim" attribute) and assumes you want to make it a "generic vector",
which conceptually just changes its mode to "list", whereas "list"
constructs a list with entries you pass as arguments.
Reid Huntsinger
-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Paul Baer
Sent: Thursday, October 13, 2005 3:41 PM
To: r-help at stat.math.ethz.ch
Subject: [R] reading matrix objects into a list
OK, I've tried to be a good citizen and use the searchable archives,
but with three search strings I haven't found the answer to what must
really be a simple question.
I want to create a list of objects from a set of matrices (in this
case, 300x300). Suppose the first matrix is A. I tried:
> x=as.list(A)
But it I get a list of length 90,000
> length(x)
[1] 90000
instead of length 1, which is what I expected.
What's the simple trick I'm missing?
Thanks,
--Paul
______________________________________________
R-help at 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
More information about the R-help
mailing list