Skip to content

Commit

Permalink
Merge branch 'master' into between-verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
jangorecki authored May 1, 2019
2 parents e25b0f4 + 9296d24 commit e18b095
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 19 deletions.
32 changes: 18 additions & 14 deletions inst/tests/tests.Rraw
Original file line number Diff line number Diff line change
Expand Up @@ -14129,39 +14129,43 @@ g = data.table(a=5:6, z=18L)
d[, z:=NULL][g, on="a", z:=i.z]
test(2030.18, .Last.updated, 0L) # zero match

# rbind vec with list regression dev 1.12.3; #3528
test(2031.01, rbind(data.table(A=1:3, B=7:9), data.table(A=4:6, B=as.list(10:12))), ans<-data.table(A=1:6, B=as.list(7:12)))
test(2031.02, rbind(data.table(A=1:3, B=as.list(7:9)), data.table(A=4:6, B=10:12)), ans)

# `between` invalid args, and verbose #3516
test(2031.01, between(1:5, 2, 4, incbounds=423), error="incbounds must be logical")
test(2031.02, between(1:5, 2, 4, incbounds=NA), error="incbounds must be logical")
test(2032.01, between(1:5, 2, 4, incbounds=423), error="incbounds must be logical")
test(2032.02, between(1:5, 2, 4, incbounds=NA), error="incbounds must be logical")
old = options(datatable.verbose=TRUE)
test(2031.05, between(1:5, 2L, 4L), output="between parallel processing of integer with recycling took")
test(2031.06, between(1:5, rep(2L,5L), rep(4L, 5L)), output="between parallel processing of integer took")
test(2031.07, between(as.double(1:5), 2, 4, incbounds=FALSE), output="between parallel processing of double using open bounds with recycling took")
test(2031.08, between(as.double(1:5), 2, 4), output="between parallel processing of double using closed bounds with recycling took")
test(2031.09, between(as.double(1:5), rep(2, 5L), rep(4, 5L)), output="between parallel processing of double took")
test(2031.10, between(c("foo","bar","paz"), "bag", "fog"), output="optimised between not available for this data type, fallback to slow R routine")
test(2032.05, between(1:5, 2L, 4L), output="between parallel processing of integer with recycling took")
test(2032.06, between(1:5, rep(2L,5L), rep(4L, 5L)), output="between parallel processing of integer took")
test(2032.07, between(as.double(1:5), 2, 4, incbounds=FALSE), output="between parallel processing of double using open bounds with recycling took")
test(2032.08, between(as.double(1:5), 2, 4), output="between parallel processing of double using closed bounds with recycling took")
test(2032.09, between(as.double(1:5), rep(2, 5L), rep(4, 5L)), output="between parallel processing of double took")
test(2032.10, between(c("foo","bar","paz"), "bag", "fog"), output="optimised between not available for this data type, fallback to slow R routine")

# `between` handle POSIXct type
x = as.POSIXct("2016-09-18 07:00:00") + 0:10*60*15
dn = as.POSIXct('2016-09-18 08:00:00')
up = as.POSIXct('2016-09-18 09:00:00')
test(2031.11, between(x, dn, up), output="between parallel processing of double using closed bounds with recycling took")
test(2031.12, between(x, dn, up, incbounds=FALSE), output="between parallel processing of double using open bounds with recycling took")
test(2032.11, between(x, dn, up), output="between parallel processing of double using closed bounds with recycling took")
test(2032.12, between(x, dn, up, incbounds=FALSE), output="between parallel processing of double using open bounds with recycling took")

## also handling of string lower/upper bounds _only when x has a time zone_
x = as.POSIXct("2016-09-18 07:00:00") + 0:10*60*15
dn = '2016-09-18 08:00:00'
up = '2016-09-18 09:00:00'
test(2031.13, between(x, dn, up), output = 'optimised between not available')
test(2032.13, between(x, dn, up), output = 'optimised between not available')
attr(x, 'tzone') = 'UTC'
test(2031.14, between(x, dn, up), output = 'between parallel processing of double')
test(2032.14, between(x, dn, up), output = 'between parallel processing of double')

### additional flexibility -- cast when one bound is already POSIXct
up = as.POSIXct(up, tz="UTC")
test(2031.15, between(x, dn, up), output = 'between parallel processing of double')
test(2032.15, between(x, dn, up), output = 'between parallel processing of double')

# `between` support `.` in RHS #2315
X = data.table(a = 1:5, b = 6:10, c = c(5:1))
test(2031.16, X[c %between% list(a, b)], X[c %between% .(a, b)])
test(2032.16, X[c %between% list(a, b)], X[c %between% .(a, b)])
options(old)


Expand Down
8 changes: 4 additions & 4 deletions revdep.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ options(repos = c("CRAN"=c("http://cloud.r-project.org")))
# and BiocManager::install()) will call this script again recursively.
Sys.unsetenv("R_PROFILE_USER")

system("sudo R -e \"utils::update.packages('/usr/lib/R/library', ask=FALSE)\"")
system("sudo R -e \"utils::update.packages('/usr/lib/R/library', ask=FALSE, checkBuilt=TRUE)\"")

require(utils) # only base is loaded when R_PROFILE_USER runs
update.packages(ask=FALSE)
update.packages(ask=FALSE, checkBuilt=TRUE)
# if package not found on mirror, try manually a different one:
# install.packages("<pkg>", repos="http://cran.stat.ucla.edu/")
# update.packages(ask=FALSE) # a repeat sometimes does more, keep repeating until none

# Follow: https://bioconductor.org/install
# Ensure no library() call in .Rprofile, such as library(bit64)
require(BiocManager)
BiocManager::install(ask=FALSE)
BiocManager::install(ask=FALSE, version="devel")
BiocManager::valid()

avail = available.packages(repos=BiocManager::repositories()) # includes CRAN at the end from getOption("repos"). And ensure latest Bioc version is in repo path here.
Expand Down Expand Up @@ -62,7 +62,7 @@ for (p in deps) {
}
cat("New downloaded:",new," Already had latest:", old, " TOTAL:", length(deps), "\n")
length(deps)
update.packages(repos=BiocManager::repositories()) # double-check all dependencies are latest too
update.packages(repos=BiocManager::repositories(), checkBuilt=TRUE) # double-check all dependencies are latest too
table(installed.packages()[,"Built"]) # ensure all built with this major release of R; e.g. none should have been built with R-devel

# Remove the tar.gz no longer needed :
Expand Down
9 changes: 8 additions & 1 deletion src/rbindlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,14 @@ SEXP rbindlist(SEXP l, SEXP usenamesArg, SEXP fillArg, SEXP idcolArg)
if (w==-1 || !length(thisCol=VECTOR_ELT(li, w))) {
writeNA(target, ansloc, thisnrow); // writeNA is integer64 aware and writes INT64_MIN
} else {
const char *ret = memrecycle(target, R_NilValue, ansloc, thisnrow, thisCol); // coerces if needed within memrecycle; possibly with a no-alloc direct coerce
bool coerced = false;
if (TYPEOF(target)==VECSXP && TYPEOF(thisCol)!=VECSXP) {
// do an as.list() on the atomic column; #3528
thisCol = PROTECT(coerceVector(thisCol, VECSXP));
coerced = true;
} // else coerces if needed within memrecycle; possibly with a no-alloc direct coerce
const char *ret = memrecycle(target, R_NilValue, ansloc, thisnrow, thisCol);
if (coerced) UNPROTECT(1);
if (ret) warning("Column %d of item %d: %s", w+1, i+1, ret); // currently just one warning when precision is lost; e.g. assigning 3.4 to integer64
}
ansloc += thisnrow;
Expand Down

0 comments on commit e18b095

Please sign in to comment.