[Rd] split() bug? Inconsistent Windows/Linux behavior.

Duncan Murdoch murdoch.duncan at gmail.com
Wed May 5 03:50:42 CEST 2010


This is now fixed in R-devel (revision 51908), and R-patched (r51909).  
Thanks Jay for the nice reproducible example, and thanks Matt for 
localizing it to the interaction() function.

Duncan Murdoch

On 04/05/2010 4:37 PM, Jay Emerson wrote:
> I didn't see anything on this in the bug reports, and a search of the
> archives had lots of false positives when searching on "split" to be
> helpful.
>
> I don't view this as particularly interesting or useful, but wanted to
> report it because I stumbled on it (and don't remember ever seeing
> "invalid permissions" as part of a segfault).  Yes, I realize this is
> a silly example that you wouldn't actually do, but... there may be
> other more interesting cases with the same problem.  The following was
> R-2.10.0 on Linux (with a Windows-64 2.11.0 difference to follow
> below):
>
>   
>> data(iris)
>> split(1:nrow(iris), list(iris[,1], iris[,2]))
>>     
>
>  *** caught segfault ***
> address 0x7fc806cd3d0c, cause 'invalid permissions'
>
> Traceback:
>  1: split.default(1:nrow(iris), list(iris[, 1], iris[, 2]))
>  2: split(1:nrow(iris), list(iris[, 1], iris[, 2]))
>
> Possible actions:
> 1: abort (with core dump, if enabled)
> 2: normal R exit
> 3: exit R without saving workspace
> 4: exit R saving workspace
>
> In contrast, R-2.11.0 in Windows-64:
>
>   
>> data(iris)
>> split(1:nrow(iris), list(iris[,1], iris[,2]))
>>     
>
> Traceback:
>  1: split.default(1:nrow(iris), list(iris[, 1], iris[, 2]))
>  2: split(1:nrow(iris), list(iris[, 1], iris[, 2]))
> Error in split.default(1:nrow(iris), list(iris[, 1], iris[, 2])) :
>   caught access violation - continue with care
>
> However, the same commands with drop=TRUE returns something, though
> the answers differ.  In Linux:
>
>   
>> a <- split(1:nrow(iris), list(iris[,1], iris[,2]), drop=TRUE)
>> length(a)
>>     
> [1] 116
>
> And in Windows, differing only in the extra returned element, which I
> don't think should probably be part of the answer (there are no
> missing values in the iris data):
>
>   
>> a <- split(1:nrow(iris), list(iris[,1], iris[,2]), drop=TRUE)
>> length(a)
>>     
> [1] 117
>   
>> a[117]
>>     
> $<NA>
> [1] 16
>
> --
> John W. Emerson (Jay)
> Associate Professor of Statistics
> Department of Statistics
> Yale University
> http://www.stat.yale.edu/~jay
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



More information about the R-devel mailing list