From luke at stat.uiowa.edu  Tue Dec  9 17:09:34 2003
From: luke at stat.uiowa.edu (Luke Tierney)
Date: Tue Dec  9 17:08:16 2003
Subject: [Rd] Maybe some bug on sapply and cbind (PR#5628)
In-Reply-To: <20031209144041.B15BBF3C4@slim.kubism.ku.dk>
Message-ID: <Pine.LNX.4.44.0312091009080.14909-100000@itasca.stat.uiowa.edu>

Simpler version seems to be

x <- list(expression(1))
y <- rep(2,1)
.Internal(unlist(x, FALSE, FALSE))
.Internal(cbind(1, y))

Seems to be related to undesirable behavior of unlist when expression
objects are involved;

> unlist(list(expression(1)), recursive = FALSE)
NULL
> unlist(list(expression(1)), recursive = TRUE)
[1] 150684992

luke

On Tue, 9 Dec 2003 brahm@alum.mit.edu wrote:

> I can confirm this bug on Solaris 2.8 running R-1.8.1.  Here's a simplified
> version:
> 
> y <- list()
> sapply(1, function(i) y[[i]] <- expression(1))
> cbind(1, rep(2,1))
> 
>   [ Process R segmentation Fault at Tue Dec  9 09:20:33 2003 ]
> 
> Curiously, replacing the third line with
>   cbind(1, 2)
> does not casue a crash, even though rep(2,1) == 2 !
> 
> 
> > R.version
> platform sparc-sun-solaris2.8
> arch     sparc               
> os       solaris2.8          
> system   sparc, solaris2.8   
> status                       
> major    1                   
> minor    8.1                 
> year     2003                
> month    11                  
> day      21                  
> language R                   
> 

-- 
Luke Tierney
University of Iowa                  Phone:             319-335-3386
Department of Statistics and        Fax:               319-335-3017
   Actuarial Science
241 Schaeffer Hall                  email:      luke@stat.uiowa.edu
Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu


[Rd] Maybe some bug on sapply and cbind (PR#5628)
Luke Tierney