From ggrothendieck at gmail.com  Tue Apr 10 19:22:35 2007
From: ggrothendieck at gmail.com (Gabor Grothendieck)
Date: Tue, 10 Apr 2007 13:22:35 -0400
Subject: [Rd] list/matrix chimera
In-Reply-To: <f8e6ff050704100930p444beafwe2b6ed1caf229927@mail.gmail.com>
References: <m2lkh0xp4i.fsf@fhcrc.org> <461BA714.5040009@blackmesacapital.com>
	<f8e6ff050704100930p444beafwe2b6ed1caf229927@mail.gmail.com>
Message-ID: <971536df0704101022q565a6ea4xd2b46ac2a283655b@mail.gmail.com>

On 4/10/07, hadley wickham <h.wickham at gmail.com> wrote:
> On 4/10/07, Tony Plate <tplate at blackmesacapital.com> wrote:
> > Aren't you just seeing the effect of drop=TRUE? (at least with the
> > examples you give below -- they all pick out a submatrix with extent one
> > on some dimension)
> >
> > AFAICT, matrices with a list as the underlying data work properly, e.g.:
> >
> >  > vv <- array(as.list(1:12), 3:4)
> >  > vv
> >       [,1] [,2] [,3] [,4]
> > [1,] 1    4    7    10
> > [2,] 2    5    8    11
> > [3,] 3    6    9    12
> >  > vv[1:2,]
> >       [,1] [,2] [,3] [,4]
> > [1,] 1    4    7    10
> > [2,] 2    5    8    11
> >  > vv[1,,drop=FALSE]
> >       [,1] [,2] [,3] [,4]
> > [1,] 1    4    7    10
> >  >
> >
> > It can actually be useful sometimes to have a matrix (or array) of
> > non-atomic objects -- wouldn't your proposed change remove (or at least
> > damage) that functionality?
>
> I use this functionality a lot in the reshape package.  I would hate
> to see it go!
>
> It would be nice to have some way to remove the [[1]] from vv[1, 2][[1]] though.

Try vv[[1,2]]



[Rd] list/matrix chimera
Gabor Grothendieck