Remy.Drouilhet@upmf-grenoble.fr
2003-Dec-09 11:29 UTC
[Rd] Maybe some bug on sapply and cbind (PR#5628)
Full_Name: Drouilhet R?my Version: 1.8.1 OS: Linux Submission from: (NULL) (195.221.43.136) Hi!!! Is there some mistake? This is some part of one of my R programs. I created this function to show you the trouble!!! bugTest<-function() { paramnames <- c("mean","sd") param <- list(expression(1),expression(2)) paramtmp <- list(mean=0,sd=1) if(length(param)) { sapply(1:length(param),function(i) paramtmp[[paramnames[i]]]<<-param[[i]]) } paramtmp } If you run :> bugTest()$mean expression(1) $sd expression(2) Everything seems Ok!!! But, now, continue by running :> cbind(1,rep(2,1))Segmentation fault In fact, every cbind, rbind applying vectors seem to fail. Now, change in the bugTest the sapply by some for instance: bugTest2<-function() { paramnames <- c("mean","sd") param <- list(expression(1),expression(2)) paramtmp <- list(mean=0,sd=1) if(length(param)) { for( i in 1:length(param)) paramtmp[[paramnames[i]]]<-param[[i]] } paramtmp }> bugTest2()$mean expression(1) $sd expression(2)> cbind(1,rep(2,1))[,1] [,2] [1,] 1 2 NOW, EVERYTHING IS OK!!! I hope this could be helpful for us!! Bye
brahm@alum.mit.edu
2003-Dec-09 15:39 UTC
[Rd] Maybe some bug on sapply and cbind (PR#5628)
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.versionplatform 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 -- -- David Brahm (brahm@alum.mit.edu)
Seemingly Similar Threads
- small bug on qchisq (PR#6442)
- ADS users authentication problem where win2k and pre-win2k names of user differ
- Migration Issues: Can't update newly added column values
- [LLVMdev] Vector argument passing abi for ARM ?
- [LLVMdev] Vector argument passing abi for ARM ?