diff --git a/.github/workflows/R-CMD-check-occasional.yaml b/.github/workflows/R-CMD-check-occasional.yaml index a2f9efdf90..5e32255e5d 100644 --- a/.github/workflows/R-CMD-check-occasional.yaml +++ b/.github/workflows/R-CMD-check-occasional.yaml @@ -15,7 +15,7 @@ jobs: fail-fast: false matrix: os: [macOS-latest, windows-latest, ubuntu-latest] - r: ['devel', 'release', '3.2', '3.3', '3.4', '3.5', '3.6', '4.0', '4.1', '4.2', '4.3'] + r: ['devel', 'release', '3.3', '3.4', '3.5', '3.6', '4.0', '4.1', '4.2', '4.3'] locale: ['en_US.utf8', 'zh_CN.utf8', 'lv_LV.utf8'] # Chinese for translations, Latvian for collate order (#3502) exclude: # only run non-English locale CI on Ubuntu @@ -28,8 +28,6 @@ jobs: - os: windows-latest locale: 'lv_LV.utf8' # macOS/arm64 only available for R>=4.1.0 - - os: macOS-latest - r: '3.2' - os: macOS-latest r: '3.3' - os: macOS-latest diff --git a/DESCRIPTION b/DESCRIPTION index 8cd783ca2f..7035cfcad2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: data.table Version: 1.15.99 Title: Extension of `data.frame` -Depends: R (>= 3.2.0) +Depends: R (>= 3.3.0) Imports: methods Suggests: bit64 (>= 4.0.0), bit (>= 4.0.4), R.utils, xts, zoo (>= 1.8-1), yaml, knitr, markdown Description: Fast aggregation of large data (e.g. 100GB in RAM), fast ordered joins, fast add/modify/delete of columns by group using no copies at all, list columns, friendly and fast character-separated-value read/write. Offers a natural and flexible syntax, for faster development. diff --git a/NEWS.md b/NEWS.md index d284e32e46..4ca151db39 100644 --- a/NEWS.md +++ b/NEWS.md @@ -66,7 +66,7 @@ 2. The documentation for the `fill` argument in `rbind()` and `rbindlist()` now notes the expected behaviour for missing `list` columns when `fill=TRUE`, namely to use `NULL` (not `NA`), [#4198](https://github.com/Rdatatable/data.table/pull/4198). Thanks @sritchie73 for the proposal and fix. -3. data.table now depends on R 3.2.0 (2015) instead of 3.1.0 (2014). 1.17.0 will likely move to R 3.3.0 (2016). Recent versions of R have good features that we would gradually like to incorporate, and we see next to no usage of these very old versions of R. +3. data.table now depends on R 3.3.0 (2016) instead of 3.1.0 (2014). Recent versions of R have good features that we would gradually like to incorporate, and we see next to no usage of these very old versions of R. We originally attempted to bump only to R 3.2.0 in this release, but {knitr} requiring 3.3.0 and `R CMD check` lacking an `--ignore-vignettes` option until 3.3.0 essentially forced our hands. 4. Erroneous assignment calls in `[` with a trailing comma (e.g. ``DT[, `:=`(a = 1, b = 2,)]``) get a friendlier error since this situation is common during refactoring and easy to miss visually. Thanks @MichaelChirico for the fix. diff --git a/R/fread.R b/R/fread.R index 3dc4468c6f..b6371899e9 100644 --- a/R/fread.R +++ b/R/fread.R @@ -78,9 +78,6 @@ yaml=FALSE, autostart=NA, tmpdir=tempdir(), tz="UTC") if (w <- startsWithAny(file, c("https://", "ftps://", "http://", "ftp://", "file://"))) { # avoid grepl() for #2531 # nocov start tmpFile = tempfile(fileext = paste0(".",tools::file_ext(file)), tmpdir=tmpdir) # retain .gz extension in temp filename so it knows to be decompressed further below - if (w<=2L && base::getRversion()<"3.2.2") { # https: or ftps: can be read by default by download.file() since 3.2.2 - stopf("URL requires download.file functionalities from R >=3.2.2. You can still manually download the file and fread the downloaded file.") - } method = if (w==5L) "internal" # force 'auto' when file: to ensure we don't use an invalid option (e.g. wget), #1668 else getOption("download.file.method", default="auto") # http: or ftp: # In text mode on Windows-only, R doubles up \r to make \r\r\n line endings. mode="wb" avoids that. See ?connections:"CRLF" diff --git a/R/utils.R b/R/utils.R index fa3fd5ad47..522736d071 100644 --- a/R/utils.R +++ b/R/utils.R @@ -21,9 +21,6 @@ nan_is_na = function(x) { stopf("Argument 'nan' must be NA or NaN") } -if (!exists('startsWith', 'package:base', inherits=FALSE)) { # R 3.3.0; Apr 2016 - startsWith = function(x, stub) substr(x, 1L, nchar(stub))==stub -} # endsWith no longer used from #5097 so no need to backport; prevent usage to avoid dev delay until GLCI's R 3.1.0 test endsWith = function(...) stop("Internal error: use endsWithAny instead of base::endsWith", call.=FALSE) diff --git a/inst/tests/nafill.Rraw b/inst/tests/nafill.Rraw index d3d0057ae2..d98e99982f 100644 --- a/inst/tests/nafill.Rraw +++ b/inst/tests/nafill.Rraw @@ -21,16 +21,6 @@ for (s in sugg) { if (!loaded) cat("\n**** Suggested package",s,"is not installed or has dependencies missing. Tests using it will be skipped.\n\n") } -# Ensure an operation uses C-locale sorting (#3502). For test set-ups/comparisons that use base operations, which are -# susceptible to locale-specific sorting issues, but shouldn't be needed for data.table code, which always uses C sorting. -# TODO(R>=3.3.0): use order(method="radix") as a way to avoid needing this helper -with_c_collate = function(expr) { - old = Sys.getlocale("LC_COLLATE") - on.exit(Sys.setlocale("LC_COLLATE", old)) - Sys.setlocale("LC_COLLATE", "C") - expr -} - x = 1:10 x[c(1:2, 5:6, 9:10)] = NA test(1.01, nafill(x, "locf"), INT(NA,NA,3,4,4,4,7,8,8,8)) diff --git a/inst/tests/tests.Rraw b/inst/tests/tests.Rraw index 258d686fb4..8e3ae8cadd 100644 --- a/inst/tests/tests.Rraw +++ b/inst/tests/tests.Rraw @@ -68,7 +68,6 @@ if (exists("test.data.table", .GlobalEnv, inherits=FALSE)) { shallow = data.table:::shallow # until exported .shallow = data.table:::.shallow split.data.table = data.table:::split.data.table - if (!exists('startsWith', 'package:base', inherits=FALSE)) startsWith = data.table:::startsWith # R 3.3.0 stopf = data.table:::stopf test = data.table:::test uniqlengths = data.table:::uniqlengths @@ -207,11 +206,6 @@ with_c_collate = function(expr) { expr } -# strrep is used many times in tests, but is from R 3.3.0, so use this equivalent if it is missing. -if (!exists("strrep", "package:base")) { - strrep = function(x, times) mapply(function(x, times) paste(rep(x, times), collapse=""), rep_len(x, length(times)), times, USE.NAMES=FALSE) -} - ########################## .do_not_rm = ls() # objects that exist at this point should not be removed by rm_all(); e.g. test_*, base_messages, Ctest_dt_win_snprintf, prevtest, etc ########################## @@ -4620,25 +4614,21 @@ test(1240.2, ans2, ans1) # Therefore we check against the non-data.table method ('shell') for correctness (otherwise we'd be # checking data.table code against itself) as well as checking data.table's ported code in R; # i.e. a three-way match. -if (base::getRversion() < "3.3.0") { - base_order <- base::order -} else { - base_order <- function(..., na.last=TRUE, method=c("shell","radix")) { - ans1 = base::order(..., na.last=na.last, method="shell") - if (!is.na(na.last) || base::getRversion()>"3.3.3") { - ans2 = base::order(..., na.last=na.last, method="radix") - if (!identical(ans1,ans2)) stop("Base R's order(,method='shell') != order(,method='radix')") - } else { - # Only when na.last=NA in just R 3.3.0-3.3.3 we don't check shell==radix - # because there was a problem in base R's port of data.table code then when : - # 1) 2 or more vectors were passed to base::order(,method="radix") - # AND 2) na.last=NA - # AND 3) there is a subgroup of size exactly 2 - # AND 4) one of those 2 items in the subgroup is NA and the other is not NA - # See tests 1728.3 and 1728.13. - } - ans1 +base_order <- function(..., na.last=TRUE, method=c("shell","radix")) { + ans1 = base::order(..., na.last=na.last, method="shell") + if (!is.na(na.last) || base::getRversion()>"3.3.3") { + ans2 = base::order(..., na.last=na.last, method="radix") + if (!identical(ans1,ans2)) stop("Base R's order(,method='shell') != order(,method='radix')") + } else { + # Only when na.last=NA in just R 3.3.0-3.3.3 we don't check shell==radix + # because there was a problem in base R's port of data.table code then when : + # 1) 2 or more vectors were passed to base::order(,method="radix") + # AND 2) na.last=NA + # AND 3) there is a subgroup of size exactly 2 + # AND 4) one of those 2 items in the subgroup is NA and the other is not NA + # See tests 1728.3 and 1728.13. } + ans1 } # Test for optimisation of 'order' to 'forder'. Copied to benchmarks.Rraw too. @@ -8908,11 +8898,7 @@ test(1622.1, ans1, ans2) test(1622.2, ans1, fread(testDir("issue_1573_fill.txt"), fill=TRUE, sep=" ", na.strings="")) # fix for #989 -# error_msg = if (base::getRversion() < "3.4") "can not be a directory name" else "does not exist" -# Until R v3.3, file.info("~") returned TRUE for isdir. This seems to return NA in current devel. However, it -# correctly identifies that "~" is not a file. So leads to another error message. So removing the error message -# so that it errors properly on both versions. This seems fine to me since we just need it to error. Tested. -test(1623, fread("~"), error="") +test(1623, fread("~"), error="File '~' is a directory") # testing print.rownames option, #1097 (part of #1523) options(datatable.print.rownames = FALSE)