[R] matrix lists
Prof Brian D Ripley
ripley at stats.ox.ac.uk
Tue Feb 26 15:05:20 CET 2002
On Tue, 26 Feb 2002, Prof Brian D Ripley wrote:
> Perhaps the following example will help demonstrate that matrix lists do
> exist and do work up to a point, despite strident assertions on R-help to
> the contrary:
>
> > m <- list(a1=1:3, a2=4:6, a3=pi, a4=c("a","b","c"))
> > dim(m) <- c(2,2)
> > m
> [,1] [,2]
> [1,] "Numeric,3" "Numeric,1"
> [2,] "Numeric,3" "Character,3"
> > is.matrix(m)
> [1] TRUE
> > m[[1,2]]
> [1] 3.141593
> > m[[2,2]]
> [1] "a" "b" "c"
>
> In S m[2,2] extracts a sub-list, but that seems not to work correctly in R:
> neither does m[,2]. I am reporting that as a bug.
The bug is now fixed in R-devel, which should make these more useful.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list