Skip to content

Commit cd8026d

Browse files
authored
Merge branch 'master' into deprec-autostart
2 parents 3530533 + 42aeddf commit cd8026d

File tree

18 files changed

+84
-117
lines changed

18 files changed

+84
-117
lines changed

NAMESPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ importFrom(methods, "S3Part<-", slotNames)
55
exportClasses(data.table, IDate, ITime)
66
##
77

8-
export(data.table, tables, setkey, setkeyv, key, "key<-", haskey, CJ, SJ, copy)
8+
export(data.table, tables, setkey, setkeyv, key, haskey, CJ, SJ, copy)
99
export(rowwiseDT)
1010
export(setindex, setindexv, indices)
1111
export(as.data.table,is.data.table,test.data.table)

NEWS.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,15 @@ rowwiseDT(
137137

138138
6. `measurev()` was implemented and documented in v1.15.0, for use within `melt()`, and it is now exported (dependent packages can now use without a NOTE from CRAN check).
139139

140-
7. Deprecation of `fread(autostart=)` has been upgraded to an error. It has been warning since v1.11.0 (6 years ago). The argument will be removed in the next release.
140+
7. The `dcast()` and `melt()` generics no longer attempt to redirect to {reshape2} methods when passed non-`data.table`s. If you're still using {reshape2}, you must use namespace-qualification: `reshape2::dcast()`, `reshape2::melt()`. We have been warning about the deprecation since v1.12.4 (2019). Please note that {reshape2} is retired.
141+
142+
8. `showProgress` in `[` is disabled for "trivial" grouping (`.NGRP==1L`), [#6668](https://github.com/Rdatatable/data.table/issues/6668). Thanks @MichaelChirico for the request and @joshhwuu for the PR.
143+
144+
9. `key<-`, marked as deprecated since 2012 and unusable since v1.15.0, has been fully removed.
145+
146+
10. Deprecation of `logicalAsInt` argument to `fwrite()` has been upgraded from a warning (since v1.15.0) to an error. It will be removed in the next release.
147+
148+
11. Deprecation of `fread(autostart=)` has been upgraded to an error. It has been warning since v1.11.0 (6 years ago). The argument will be removed in the next release.
141149
142150
# data.table [v1.16.2](https://github.com/Rdatatable/data.table/milestone/35) (9 October 2024)
143151

R/data.table.R

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -459,9 +459,9 @@ replace_dot_alias = function(e) {
459459
if (!len_common_names) stopf("Attempting to do natural join but no common columns in provided tables")
460460
if (verbose) {
461461
which_cols_msg = if (len_common_names == length(x)) {
462-
catf("Joining but 'x' has no key, natural join using all 'x' columns")
462+
catf("Joining but 'x' has no key, natural join using all 'x' columns\n")
463463
} else {
464-
catf("Joining but 'x' has no key, natural join using: %s", brackify(common_names))
464+
catf("Joining but 'x' has no key, natural join using: %s\n", brackify(common_names))
465465
}
466466
}
467467
on = common_names
@@ -2077,8 +2077,6 @@ as.matrix.data.table = function(x, rownames=NULL, rownames.value=NULL, ...) {
20772077
if (!is.null(rownames)) {
20782078
if (!is.null(rownames.value)) stopf("rownames and rownames.value cannot both be used at the same time")
20792079
if (length(rownames)>1L) {
2080-
# TODO in future as warned in NEWS for 1.11.6:
2081-
# warningf("length(rownames)>1 is deprecated. Please use rownames.value= instead")
20822080
if (length(rownames)!=nrow(x))
20832081
stopf("length(rownames)==%d but nrow(DT)==%d. The rownames argument specifies a single column name or number. Consider rownames.value= instead.", length(rownames), nrow(x))
20842082
rownames.value = rownames

R/fcast.R

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,10 @@ dcast <- function(
1212
data, formula, fun.aggregate = NULL, ..., margins = NULL,
1313
subset = NULL, fill = NULL, value.var = guess(data)
1414
) {
15-
if (is.data.table(data)) UseMethod("dcast", data)
16-
# nocov start
17-
else {
18-
data_name = deparse(substitute(data))
19-
ns = tryCatch(getNamespace("reshape2"), error=function(e)
20-
stopf("The %1$s generic in data.table has been passed a %2$s, but data.table::%1$s currently only has a method for data.tables. Please confirm your input is a data.table, with setDT(%3$s) or as.data.table(%3$s). If you intend to use a method from reshape2, try installing that package first, but do note that reshape2 is superseded and is no longer actively developed.", "dcast", class1(data), data_name))
21-
warningf("The %1$s generic in data.table has been passed a %2$s and will attempt to redirect to the relevant reshape2 method; please note that reshape2 is superseded and is no longer actively developed, and this redirection is now deprecated. Please do this redirection yourself like reshape2::%1$s(%3$s). In the next version, this warning will become an error.", "dcast", class1(data), data_name)
22-
ns$dcast(data, formula, fun.aggregate = fun.aggregate, ..., margins = margins,
23-
subset = subset, fill = fill, value.var = value.var)
24-
}
25-
# nocov end
15+
# TODO(>=1.19.0): Remove this, just let dispatch to 'default' method fail.
16+
if (!is.data.table(data))
17+
stopf("The %1$s generic in data.table has been passed a %2$s, but data.table::%1$s currently only has a method for data.tables. Please confirm your input is a data.table, with setDT(%3$s) or as.data.table(%3$s). If you intend to use a method from reshape2, try installing that package first, but do note that reshape2 is superseded and is no longer actively developed.", "dcast", class1(data), deparse(substitute(data))) # nocov
18+
UseMethod("dcast", data)
2619
}
2720

2821
check_formula = function(formula, varnames, valnames, value.var.in.LHSdots, value.var.in.RHSdots) {

R/fmelt.R

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
11
# reshape2 dependency was originally abandoned because (1) we wanted to be in control
22
# of the R version dependency and (2) reshape2::dcast is not generic.
3-
# reshape2 package is deprecated since December 2017, so we'll deprecate our
3+
# reshape2 package is deprecated since December 2017, so we've deprecated our
44
# redirection as well
55

66
melt = function(data, ..., na.rm = FALSE, value.name = "value") {
77
UseMethod("melt", data)
88
}
99

10+
# TODO(>=1.19.0): Remove this, just let dispatch to 'default' method fail.
1011
melt.default = function(data, ..., na.rm = FALSE, value.name = "value") {
11-
# if no registered method exists for data, attempts to redirect data to reshape2::melt;
12-
# CRAN package edarf and others fail without the redirection
13-
# nocov start
14-
data_name = deparse(substitute(data))
15-
ns = tryCatch(getNamespace("reshape2"), error=function(e)
16-
stopf("The %1$s generic in data.table has been passed a %2$s, but data.table::%1$s currently only has a method for data.tables. Please confirm your input is a data.table, with setDT(%3$s) or as.data.table(%3$s). If you intend to use a method from reshape2, try installing that package first, but do note that reshape2 is superseded and is no longer actively developed.", "melt", class1(data), data_name))
17-
warningf("The %1$s generic in data.table has been passed a %2$s and will attempt to redirect to the relevant reshape2 method; please note that reshape2 is superseded and is no longer actively developed, and this redirection is now deprecated. To continue using melt methods from reshape2 while both packages are attached, e.g. melt.list, you can prepend the namespace, i.e. reshape2::%1$s(%3$s). In the next version, this warning will become an error.", "melt", class1(data), data_name)
18-
ns$melt(data, ..., na.rm=na.rm, value.name=value.name)
19-
# nocov end
12+
stopf("The %1$s generic in data.table has been passed a %2$s and will attempt to redirect to the relevant reshape2 method; please note that reshape2 is superseded and is no longer actively developed, and this redirection is now deprecated. To continue using melt methods from reshape2 while both packages are attached, e.g. melt.list, you can prepend the namespace, i.e. reshape2::%1$s(%3$s). In the next version, this warning will become an error.", "melt", class1(data), deparse(substitute(data))) # nocov
2013
}
2114

2215
patterns = function(..., cols=character(0L), ignore.case=FALSE, perl=FALSE, fixed=FALSE, useBytes=FALSE) {

R/fwrite.R

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ fwrite = function(x, file="", append=FALSE, quote="auto",
44
na="", dec=".", row.names=FALSE, col.names=TRUE,
55
qmethod=c("double","escape"),
66
logical01=getOption("datatable.logical01", FALSE), # due to change to TRUE; see NEWS
7-
logicalAsInt=logical01,
7+
logicalAsInt=NULL,
88
scipen=getOption('scipen', 0L),
99
dateTimeAs = c("ISO","squash","epoch","write.csv"),
1010
buffMB=8, nThread=getDTthreads(verbose),
@@ -24,12 +24,8 @@ fwrite = function(x, file="", append=FALSE, quote="auto",
2424
else if (length(dateTimeAs)>1L) stopf("dateTimeAs must be a single string")
2525
dateTimeAs = chmatch(dateTimeAs, c("ISO","squash","epoch","write.csv"))-1L
2626
if (is.na(dateTimeAs)) stopf("dateTimeAs must be 'ISO','squash','epoch' or 'write.csv'")
27-
if (!missing(logical01) && !missing(logicalAsInt))
28-
stopf("logicalAsInt has been renamed logical01. Use logical01 only, not both.")
29-
if (!missing(logicalAsInt)) {
30-
warningf("logicalAsInt has been renamed logical01 for consistency with fread. It works fine for now but please change to logical01 at your convenience so we can remove logicalAsInt in future.")
31-
logical01 = logicalAsInt
32-
logicalAsInt=NULL
27+
if (!is.null(logicalAsInt)) {
28+
stopf("logicalAsInt has been renamed logical01 for consistency with fread.")
3329
}
3430
scipen = if (is.numeric(scipen)) as.integer(scipen) else 0L
3531
buffMB = as.integer(buffMB)

R/setkey.R

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ setindexv = function(x, cols, verbose=getOption("datatable.verbose")) {
1818
}
1919
}
2020

21-
# Has been warning since 2012, with stronger warning in Mar 2019 (note in news for 1.12.2); #3399
22-
"key<-" = function(x,value) {
23-
stopf("key(x)<-value is deprecated and not supported. Please change to use setkey() with perhaps copy(). Has been warning since 2012.")
24-
}
25-
2621
setkeyv = function(x, cols, verbose=getOption("datatable.verbose"), physical=TRUE)
2722
{
2823
if (is.null(cols)) { # this is done on a data.frame when !cedta at top of [.data.table

inst/tests/tests.Rraw

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,11 +1645,7 @@ test(504, dtB$k, 1:4) # or dtB
16451645
DT = data.table(a=1:2,b=1:4,key="a")
16461646
test(505, DT[J(a=1,b=6),sum(i.b*b),by=.EACHI]$V1, 24) # 24 now 'double' because i.b is 'double'
16471647

1648-
# Test := after a key<-
1649-
DT = data.table(a=3:1,b=4:6)
1650-
test(506, key(DT)<-"a", error="deprecated")
1651-
1652-
# tests 508, 509, 510 related to follow-up operations after key<-, which are now irrelevant
1648+
# tests 506, 508, 509, 510 related to follow-up operations after key<-, which are now irrelevant
16531649

16541650
# Test new functions chmatch and %chin%
16551651
y=letters
@@ -10937,10 +10933,7 @@ test(1736.03, fwrite(DT, sep2=c("",",","")), error="sep.*,.*sep2.*,.*must all be
1093710933
test(1736.04, fwrite(DT, sep2=c("","||","")), error="nchar.*sep2.*2")
1093810934
test(1736.05, capture.output(fwrite(DT, sep='|', sep2=c("c(",",",")"), logical01=FALSE)), c("A|B|C", "1|c(1,2,3,4,5,6,7,8,9,10)|c(s,t,u,v,w)",
1093910935
"2|c(15,16,17,18)|c(1.2,2.3,3.4,3.14159265358979,-9)", "3|c(7)|c(foo,bar)", "4|c(9,10)|c(TRUE,TRUE,FALSE)"))
10940-
test(1736.06, capture.output(fwrite(DT, sep='|', sep2=c("{",",","}"), logicalAsInt=TRUE)),
10941-
c("A|B|C", "1|{1,2,3,4,5,6,7,8,9,10}|{s,t,u,v,w}",
10942-
"2|{15,16,17,18}|{1.2,2.3,3.4,3.14159265358979,-9}", "3|{7}|{foo,bar}", "4|{9,10}|{1,1,0}"),
10943-
warning="logicalAsInt has been renamed logical01")
10936+
test(1736.06, fwrite(DT, sep='|', sep2=c("{",",","}"), logicalAsInt=TRUE), error="logicalAsInt has been renamed logical01")
1094410937
DT = data.table(A=c("foo","ba|r","baz"))
1094510938
test(1736.07, capture.output(fwrite(DT,na="")), c("A","foo","ba|r","baz")) # no list column so no need to quote
1094610939
test(1736.08, capture.output(fwrite(DT)), c("A","foo","ba|r","baz"))
@@ -15961,8 +15954,7 @@ DT[ , z := 0L]
1596115954
test(2074.31, dcast(DT, V1 ~ z, fun.aggregate=eval(quote(length)), value.var='z'),
1596215955
data.table(V1=c('a', 'b'), `0`=2:1,key='V1'))
1596315956

15964-
# fwrite both logical args
15965-
test(2074.32, fwrite(DT, logical01=TRUE, logicalAsInt=TRUE), error="logicalAsInt has been renamed")
15957+
# 2074.32 tested that setting both logical01 and logicalAsInt errored; no longer relevant
1596615958

1596715959
# merge.data.table
1596815960
test(2074.33, merge(DT, DT, by.x = 1i, by.y=1i), error="A non-empty vector of column names is required")

man/deprecated.Rd

Lines changed: 0 additions & 16 deletions
This file was deleted.

man/fread.Rd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ key=NULL, index=NULL,
2222
showProgress=getOption("datatable.showProgress", interactive()),
2323
data.table=getOption("datatable.fread.datatable", TRUE),
2424
nThread=getDTthreads(verbose),
25-
logical01=getOption("datatable.logical01", FALSE), # due to change to TRUE; see NEWS
25+
logical01=getOption("datatable.logical01", FALSE),
2626
logicalYN=getOption("datatable.logicalYN", FALSE),
2727
keepLeadingZeros = getOption("datatable.keepLeadingZeros", FALSE),
2828
yaml=FALSE, autostart=NULL, tmpdir=tempdir(), tz="UTC"

0 commit comments

Comments
 (0)