From 8f9e477355a56ed6d805dc14df087a23b7fe039c Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Thu, 20 May 2021 16:42:05 -0700 Subject: [PATCH 1/3] as.data.table.R --- R/as.data.table.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/as.data.table.R b/R/as.data.table.R index a706aecb86..9d286d7f16 100644 --- a/R/as.data.table.R +++ b/R/as.data.table.R @@ -102,7 +102,7 @@ as.data.table.array = function(x, keep.rownames=FALSE, key=NULL, sorted=TRUE, va dnx } else dnx val = rev(val) - if (is.null(names(val)) || all(!nzchar(names(val)))) + if (is.null(names(val)) || !any(nzchar(names(val)))) setattr(val, 'names', paste0("V", rev(seq_along(val)))) if (value.name %chin% names(val)) stop("Argument 'value.name' should not overlap with column names in result: ", brackify(rev(names(val)))) From 1f2e91c9647e9b21ab7ba02b184c392fd84debac Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Thu, 20 May 2021 16:42:56 -0700 Subject: [PATCH 2/3] data.table.R --- R/data.table.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/data.table.R b/R/data.table.R index c070f7dcb6..0a0efd326d 100644 --- a/R/data.table.R +++ b/R/data.table.R @@ -1116,7 +1116,7 @@ replace_dot_alias = function(e) { lhs = names_x[m] } else stop("LHS of := isn't column names ('character') or positions ('integer' or 'numeric')") - if (all(!is.na(m))) { + if (!anyNA(m)) { # updates by reference to existing columns cols = as.integer(m) newnames=NULL From 96650ff8bc479368adc1e3daf571ccab1c6d7f8d Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Thu, 20 May 2021 16:43:22 -0700 Subject: [PATCH 3/3] xts.R --- R/xts.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/xts.R b/R/xts.R index 121f36f1bd..31c5ad2309 100644 --- a/R/xts.R +++ b/R/xts.R @@ -19,7 +19,7 @@ as.xts.data.table = function(x, ...) { stopifnot(requireNamespace("xts"), !missing(x), is.data.table(x)) if (!xts::is.timeBased(x[[1L]])) stop("data.table must have a time based column in first position, use `setcolorder` function to change the order, or see ?timeBased for supported types") colsNumeric = vapply_1b(x, is.numeric)[-1L] # exclude first col, xts index - if (any(!colsNumeric)) warning("Following columns are not numeric and will be omitted: ", brackify(names(colsNumeric)[!colsNumeric])) + if (!all(colsNumeric)) warning("Following columns are not numeric and will be omitted: ", brackify(names(colsNumeric)[!colsNumeric])) r = setDF(x[, .SD, .SDcols = names(colsNumeric)[colsNumeric]]) return(xts::as.xts(r, order.by = if ("IDate" %chin% class(x[[1L]])) as.Date(x[[1L]]) else x[[1L]])) }