Re: [R] problem rbind after lapply (difference between 2.2.1 and 2.3.0)

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Wed 10 May 2006 - 23:42:42 EST

Update your R:

https://www.stat.math.ethz.ch/pipermail/r-devel/2006-May/037542.html

On 5/10/06, Gary Collins <collins.gs@gmail.com> wrote:
> Any help on the following would be appreciated...
>
> > R.version
> _
> platform i386-pc-mingw32
> arch i386
> os mingw32
> system i386, mingw32
> status
> major 2
> minor 2.1
> year 2005
> month 12
> day 20
> svn rev 36812
> > language R
> > set.seed(2)
> > x=matrix(ncol=4, nrow=10)
> > for(i in 1:4) x[,i]=rnorm(10)
> > x=as.data.frame(x)
> > x$V1=c(rep(0,5), rep(1,5))
> > x
> V1 V2 V3 V4
> 1 0 0.41765075 2.090819205 0.7389386
> 2 0 0.98175278 -1.199925820 0.3189604
> 3 0 -0.39269536 1.589638200 1.0761644
> 4 0 -1.03966898 1.954651642 -0.2841577
> 5 0 1.78222896 0.004937777 -0.7766753
> 6 1 -2.31106908 -2.451706388 -0.5956605
> 7 1 0.87860458 0.477237303 -1.7259798
> 8 1 0.03580672 -0.596558169 -0.9025845
> 9 1 1.01282869 0.792203270 -0.5590619
> 10 1 0.43226515 0.289636710 -0.2465126
>
> > do.call("rbind", lapply(split(x, x$V1), function(x) data.frame(min=min(x$V2), max=max(x$V2))))
> min max
> 0 -1.039669 1.782229
> 1 -2.311069 1.012829
>
> yet with the same call on version 2.3.0, I get the following error.
>
> > do.call("rbind", lapply(split(x, x$V1), function(x) data.frame(min=min(x$V2), max=max(x$V2))))
> Error in data.frame(min = c("-1.039669", "-2.311069"), max = c("1.782229", :
> row names contain missing values
>
> Any clues on what has changed between the two versions? and a fix to
> get around this? The actual function (min, max) within the lapply is
> just an example for illustration only, the issue is the "rbinding" of
> results from an lapply call. I've had a look at the changes document
> packaged with 2.3.0 and found nothing...so wondering whether it's a
> bug or not?
>
> Thanks in advance.
>
> Gary
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed May 10 23:52:24 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 11 May 2006 - 02:10:07 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.