From ripley at stats.ox.ac.uk  Sat Mar 27 09:00:48 2004
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Sat Mar 27 09:00:54 2004
Subject: [Rd] cbind/rbind fail on matrixes containing lists (PR#6702)
In-Reply-To: <20040326220928.E325910438@slim.kubism.ku.dk>
Message-ID: <Pine.LNX.4.44.0403270736160.11650-100000@gannet.stats>

There are no `matrixes containing lists'.  There are lists which are also 
matrices, but their contents are the vector elements  (unless you meant 
that it was a list of lists, which seems not be the case in your example).
In the absence of a reproducible example, it is not clear to me exactly 
what you want to do.

Here is a list matrix example:

A <- matrix(as.list(1:4), 2, 2)
cbind(A, A)

It appears to be intentional (line 950 of bind.c and the actual cbind
code), in which case this is a documentation bug and I have altered the
docs.


On Fri, 26 Mar 2004 gregory_r_warnes@groton.pfizer.com wrote:

> 
> Today's R 1.9.0 beta:
> 
> > m1
>      [,1] [,2] [,3] [,4]
> [1,] NA   NA   NA   NA  
> [2,] NA   NA   NA   NA  
> [3,] NA   NA   NA   NA  
> [4,] NA   NA   NA   NA  
> > class(m1[1,1])
> [1] "list"

Why not class(m1)?  It should be the same ....

> > cbind(m1,m1)
> Error in cbind(...) : cannot create a matrix from these types
> > rbind(m1,m1)
> Error in rbind(...) : cannot create a matrix from these types
> 
> > version
>          _                   
> platform sparc-sun-solaris2.8
> arch     sparc               
> os       solaris2.8          
> system   sparc, solaris2.8   
> status   beta                
> major    1                   
> minor    9.0                 
> year     2004                
> month    03                  
> day      26                  
> language R                   


-- 
Brian D. Ripley,                  ripley@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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


[Rd] cbind/rbind fail on matrixes containing lists (PR#6702)
Prof Brian Ripley