## Regression tests for R >= 3.0.0 pdf("reg-tests-1c.pdf", encoding = "ISOLatin1.enc") ## mapply with classed objects with length method ## was not documented to work in 2.x.y setClass("A", representation(aa = "integer")) a <- new("A", aa = 101:106) setMethod("length", "A", function(x) length(x@aa)) setMethod("[[", "A", function(x, i, j, ...) x@aa[[i]]) (z <- mapply(function(x, y) {x * y}, a, rep(1:3, 2))) stopifnot(z == c(101, 204, 309, 104, 210, 318)) ## reported as a bug (which it was not) by H. Pages in ## https://stat.ethz.ch/pipermail/r-devel/2012-November/065229.html ## recyling in split() ## https://stat.ethz.ch/pipermail/r-devel/2013-January/065700.html x <- 1:6 y <- split(x, 1:2) class(x) <- "A" yy <- split(x, 1:2) stopifnot(identical(y, yy)) ## were different in R < 3.0.0 ## dates with fractional seconds after 2038 (PR#15200) ## Extremely speculative! z <- as.POSIXct(2^31+c(0.4, 0.8), origin=ISOdatetime(1970,1,1,0,0,0,tz="GMT")) zz <- format(z) stopifnot(zz[1] == zz[2]) ## printed form rounded not truncated in R < 3.0.0