Floating point excepting when cbind()ing a matrix of grobs (orenvironments) with a 0-column matrix
I think the following patch to src/main/bind.c fixes it up.
If the length of an argument to [cr]bind is 0 then it wont't
try to add any data from it to the output any more, just as
is done with the other modes of data. It was getting the FPE
from i%k when k==0.
Index: src/main/bind.c
===================================================================
--- src/main/bind.c (revision 47617)
+++ src/main/bind.c (working copy)
@@ -1218,10 +1218,12 @@
case LISTSXP:
PROTECT(u = coerceVector(u, mode));
k = LENGTH(u);
- idx = (!isMatrix(u)) ? rows : k;
- for (i = 0; i < idx; i++)
- SET_VECTOR_ELT(result, n++,
- duplicate(VECTOR_ELT(u, i % k)));
+ if (k>0) {
+ idx = (!isMatrix(u)) ? rows : k;
+ for (i = 0; i < idx; i++)
+ SET_VECTOR_ELT(result, n++,
+ duplicate(VECTOR_ELT(u, i %
k)));
+ }
UNPROTECT(1);
break;
default:
Bill Dunlap
TIBCO Software Inc - Spotfire Division
wdunlap tibco.com
-----Original Message----- From: r-devel-bounces at r-project.org [mailto:r-devel-bounces at r-project.org] On Behalf Of hadley wickham Sent: Monday, January 19, 2009 7:18 AM To: r-devel at r-project.org Subject: [Rd] Floating point excepting when cbind()ing a matrix of grobs (orenvironments) with a 0-column matrix library(grid) e <- rectGrob() # OR: # e <- environment() a <- matrix(list(e), ncol = 1, nrow = 2) b <- matrix(ncol = 0, nrow = 2) cbind(a, b) cbind(a, b) This reliably crashes R for me. I realise this is a rather esoteric error condition, but it crops up for me when creating matrices of grobs to be turned into a ggplot2 plot. Hadley -- http://had.co.nz/
______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel