Skip to content

Commit 26cb165

Browse files
committed
Merge branch 'master' into forder_segfault
2 parents 42ff307 + 70c64ac commit 26cb165

File tree

14 files changed

+70
-91
lines changed

14 files changed

+70
-91
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: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,14 @@ rowwiseDT(
141141

142142
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.
143143
144+
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.
145+
146+
9. `key<-`, marked as deprecated since 2012 and unusable since v1.15.0, has been fully removed.
147+
148+
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.
149+
150+
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.
151+
144152
# data.table [v1.16.2](https://github.com/Rdatatable/data.table/milestone/35) (9 October 2024)
145153
146154
## BUG FIXES

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/fread.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ showProgress=getOption("datatable.showProgress",interactive()), data.table=getOp
77
nThread=getDTthreads(verbose), logical01=getOption("datatable.logical01",FALSE),
88
logicalYN=getOption("datatable.logicalYN", FALSE),
99
keepLeadingZeros=getOption("datatable.keepLeadingZeros",FALSE),
10-
yaml=FALSE, autostart=NA, tmpdir=tempdir(), tz="UTC")
10+
yaml=FALSE, autostart=NULL, tmpdir=tempdir(), tz="UTC")
1111
{
1212
if (missing(input)+is.null(file)+is.null(text)+is.null(cmd) < 3L) stopf("Used more than one of the arguments input=, file=, text= and cmd=.")
1313
input_has_vars = length(all.vars(substitute(input)))>0L # see news for v1.11.6
@@ -124,7 +124,7 @@ yaml=FALSE, autostart=NA, tmpdir=tempdir(), tz="UTC")
124124

125125
input = file
126126
}
127-
if (!missing(autostart)) warningf("'autostart' is now deprecated and ignored. Consider skip='string' or skip=n");
127+
if (!is.null(autostart)) stopf("'autostart' is deprecated. Consider skip='string' or skip=n. This argument will be removed in the next release.");
128128
if (is.logical(colClasses)) {
129129
if (!allNA(colClasses)) stopf("colClasses is type 'logical' which is ok if all NA but it has some TRUE or FALSE values in it which is not allowed. Please consider the drop= or select= argument instead. See ?fread.")
130130
colClasses = NULL

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: 5 additions & 13 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
@@ -2908,7 +2904,7 @@ test(966, fread(input, colClasses=list(character=2:4)), data.table(A=1:2, B=c("f
29082904
# Character input more than 4096 bytes (used to be passed through path.expand which imposed the limit), #2649
29092905
test(967, nrow(fread( strrep('a\tb\n', 10000L), header=FALSE)), 10000L)
29102906

2911-
# Test fread warns about removal of any footer (and autostart skips up over it)
2907+
# Test fread warns about removal of any footer (and skip= skips up over it)
29122908
test(968, fread("A,B\n1,3\n2,4\n\nRowcount: 2\n"), data.table(A=1:2,B=3:4), warning="Discarded single-line footer.*Rowcount: 2")
29132909
test(969, fread("A,B\n1,3\n2,4\n\n\nRowcount: 2"), data.table(A=1:2,B=3:4), warning="Discarded single-line footer.*Rowcount: 2")
29142910
test(970, fread("A,B\n1,3\n2,4\n\n\nRowcount: 2\n\n"), data.table(A=1:2,B=3:4), warning="Discarded single-line footer.*Rowcount: 2")
@@ -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"))
@@ -13184,7 +13177,7 @@ test(1925.10, as.ITime(x), structure(c(12L, 67L), class="ITime"))
1318413177
test(1925.11, as.ITime(x, ms='nearest'), structure(c(12L, 68L), class="ITime"))
1318513178
test(1925.12, as.ITime(x, ms='ceil'), structure(c(13L, 68L), class="ITime"))
1318613179

13187-
test(1936.1, fread("A,B\n1,3\n2,4", autostart=1), data.table(A=1:2, B=3:4), warning="autostart.*deprecated.*Consider skip")
13180+
test(1936.1, fread("A,B\n1,3\n2,4", autostart=1), error="autostart.*deprecated.*Consider skip")
1318813181
if (.Platform$OS.type == "unix") test(1936.2, is.data.table(fread("ls .")))
1318913182

1319013183
# add helpful error to %between%
@@ -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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ 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),
28-
yaml=FALSE, autostart=NA, tmpdir=tempdir(), tz="UTC"
28+
yaml=FALSE, autostart=NULL, tmpdir=tempdir(), tz="UTC"
2929
)
3030
}
3131
\arguments{
@@ -65,7 +65,7 @@ yaml=FALSE, autostart=NA, tmpdir=tempdir(), tz="UTC"
6565
\item{logicalYN}{If TRUE a column containing only Ys and Ns will be read as logical, otherwise as character.}
6666
\item{keepLeadingZeros}{If TRUE a column containing numeric data with leading zeros will be read as character, otherwise leading zeros will be removed and converted to numeric.}
6767
\item{yaml}{ If \code{TRUE}, \code{fread} will attempt to parse (using \code{\link[yaml]{yaml.load}}) the top of the input as YAML, and further to glean parameters relevant to improving the performance of \code{fread} on the data itself. The entire YAML section is returned as parsed into a \code{list} in the \code{yaml_metadata} attribute. See \code{Details}. }
68-
\item{autostart}{ Deprecated and ignored with warning. Please use \code{skip} instead. }
68+
\item{autostart}{ Deprecated. Please use \code{skip} instead. }
6969
\item{tmpdir}{ Directory to use as the \code{tmpdir} argument for any \code{tempfile} calls, e.g. when the input is a URL or a shell command. The default is \code{tempdir()} which can be controlled by setting \code{TMPDIR} before starting the R session; see \code{\link[base:tempfile]{base::tempdir}}. }
7070
\item{tz}{ Relevant to datetime values which have no Z or UTC-offset at the end, i.e. \emph{unmarked} datetime, as written by \code{\link[utils:write.table]{utils::write.csv}}. The default \code{tz="UTC"} reads unmarked datetime as UTC POSIXct efficiently. \code{tz=""} reads unmarked datetime as type character (slowly) so that \code{as.POSIXct} can interpret (slowly) the character datetimes in local timezone; e.g. by using \code{"POSIXct"} in \code{colClasses=}. Note that \code{fwrite()} by default writes datetime in UTC including the final Z and therefore \code{fwrite}'s output will be read by \code{fread} consistently and quickly without needing to use \code{tz=} or \code{colClasses=}. If the \code{TZ} environment variable is set to \code{"UTC"} (or \code{""} on non-Windows where unset vs `""` is significant) then the R session's timezone is already UTC and \code{tz=""} will result in unmarked datetimes being read as UTC POSIXct. For more information, please see the news items from v1.13.0 and v1.14.0. }
7171
}

man/fwrite.Rd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fwrite(x, file = "", append = FALSE, quote = "auto",
1212
na = "", dec = ".", row.names = FALSE, col.names = TRUE,
1313
qmethod = c("double","escape"),
1414
logical01 = getOption("datatable.logical01", FALSE), # due to change to TRUE; see NEWS
15-
logicalAsInt = logical01, # deprecated
15+
logicalAsInt = NULL, # deprecated
1616
scipen = getOption('scipen', 0L),
1717
dateTimeAs = c("ISO","squash","epoch","write.csv"),
1818
buffMB = 8L, nThread = getDTthreads(verbose),

0 commit comments

Comments
 (0)