Skip to content

Commit 70c64ac

Browse files
Progress deprecation of autostart (#6653)
Co-authored-by: Benjamin Schwendinger <[email protected]>
1 parent 42aeddf commit 70c64ac

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ rowwiseDT(
145145
146146
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.
147147
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.
149+
148150
# data.table [v1.16.2](https://github.com/Rdatatable/data.table/milestone/35) (9 October 2024)
149151
150152
## BUG FIXES

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

inst/tests/tests.Rraw

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2904,7 +2904,7 @@ test(966, fread(input, colClasses=list(character=2:4)), data.table(A=1:2, B=c("f
29042904
# Character input more than 4096 bytes (used to be passed through path.expand which imposed the limit), #2649
29052905
test(967, nrow(fread( strrep('a\tb\n', 10000L), header=FALSE)), 10000L)
29062906

2907-
# 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)
29082908
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")
29092909
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")
29102910
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")
@@ -13177,7 +13177,7 @@ test(1925.10, as.ITime(x), structure(c(12L, 67L), class="ITime"))
1317713177
test(1925.11, as.ITime(x, ms='nearest'), structure(c(12L, 68L), class="ITime"))
1317813178
test(1925.12, as.ITime(x, ms='ceil'), structure(c(13L, 68L), class="ITime"))
1317913179

13180-
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")
1318113181
if (.Platform$OS.type == "unix") test(1936.2, is.data.table(fread("ls .")))
1318213182

1318313183
# add helpful error to %between%

man/fread.Rd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ nThread=getDTthreads(verbose),
2525
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
}

0 commit comments

Comments
 (0)