Skip to content

Commit db7b822

Browse files
Merge branch 'master' into refactor-helper-function-issue-6702
2 parents 154aabd + 7445df7 commit db7b822

File tree

5 files changed

+20
-22
lines changed

5 files changed

+20
-22
lines changed

.github/workflows/pkgup.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
cp -R ${{ env.R_LIBS_USER }} library
5151
R CMD INSTALL --library="library" $(ls -1t data.table_*.tar.gz | head -n 1) --html
5252
mkdir -p doc/html
53-
cp /usr/share/R/doc/html/{left.jpg,up.jpg,Rlogo.svg,R.css,index.html} doc/html
53+
cp $(R RHOME)/doc/html/{left.jpg,up.jpg,Rlogo.svg,R.css,index.html} doc/html
5454
Rscript -e 'utils::make.packages.html("library", docdir="doc")'
5555
sed -i "s|file://|../..|g" doc/html/packages.html
5656
mkdir -p public

NEWS.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,12 @@ rowwiseDT(
176176
177177
9. `key<-`, marked as deprecated since 2012 and unusable since v1.15.0, has been fully removed.
178178
179-
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.
179+
10. The following in-progress deprecations have proceeded:
180180
181-
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.
182-
183-
12. Deprecation of `droplevels(in.place=TRUE)` (warning since v1.16.0) has been upgraded from warning to error. The argument will be removed in the next release.
181+
+ Using `fwrite(logicalAsInt=)` has been upgraded from a warning (since v1.15.0) to an error. It will be removed in the next release.
182+
+ Using `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.
183+
+ Using `droplevels(in.place=TRUE)` (warning since v1.16.0) has been upgraded from warning to error. The argument will be removed in the next release.
184+
+ Use of `:=` and `with=FALSE` in `[` has been upgraded from warning (since v1.15.0) to error. Long ago (before 2014), this was needed when, e.g., assigning to a vector of column names defined outside the table, but `with=FALSE` is no longer needed to do so: `DT[, (cols) := ...]` works fine.
184185
185186
# data.table [v1.16.4](https://github.com/Rdatatable/data.table/milestone/36) 4 December 2024
186187

R/as.data.table.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ as.data.table.list = function(x,
214214
}
215215

216216
as.data.table.data.frame = function(x, keep.rownames=FALSE, key=NULL, ...) {
217+
if (is.data.table(x)) return(as.data.table.data.table(x)) # S3 is weird, #6739. Also # nocov; this is tested in 2302.{2,3}, not sure why it doesn't show up in coverage.
217218
if (!identical(class(x), "data.frame")) return(as.data.table(as.data.frame(x)))
218219
if (!isFALSE(keep.rownames)) {
219220
# can specify col name to keep.rownames, #575; if it's the same as key,

R/data.table.R

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -705,19 +705,11 @@ replace_dot_alias = function(e) {
705705
# j was substituted before dealing with i so that := can set allow.cartesian=FALSE (#800) (used above in i logic)
706706
if (is.null(jsub)) return(NULL)
707707

708-
if (!with && jsub %iscall% ":=") {
709-
# TODO: make these both errors (or single long error in both cases) in next release.
710-
# i.e. using with=FALSE together with := at all will become an error. Eventually with will be removed.
711-
if (is.null(names(jsub)) && is.name(jsub[[2L]])) {
712-
warningf("with=FALSE together with := was deprecated in v1.9.4 released Oct 2014. Please wrap the LHS of := with parentheses; e.g., DT[,(myVar):=sum(b),by=a] to assign to column name(s) held in variable myVar. See ?':=' for other examples. As warned in 2014, this is now a warning.")
713-
jsub[[2L]] = eval(jsub[[2L]], parent.frame(), parent.frame())
714-
} else {
715-
warningf("with=FALSE ignored, it isn't needed when using :=. See ?':=' for examples.")
716-
}
717-
with = TRUE
718-
}
719-
720708
if (!with) {
709+
if (jsub %iscall% ":=") {
710+
# TODO(>=1.18.0): Simplify this error
711+
stopf("with=FALSE together with := was deprecated in v1.9.4 released Oct 2014; this has been warning since v1.15.0. Please wrap the LHS of := with parentheses; e.g., DT[,(myVar):=sum(b),by=a] to assign to column name(s) held in variable myVar. See ?':=' for other examples.")
712+
}
721713
# missingby was already checked above before dealing with i
722714
if (jsub %iscall% c("!", "-") && length(jsub)==2L) { # length 2 to only match unary, #2109
723715
notj = TRUE

inst/tests/tests.Rraw

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4655,7 +4655,7 @@ test(1241, DT[order(x,-y)], # optimized to forder()
46554655

46564656
DT = data.table(a=1:3, b=4:6)
46574657
myCol = "a"
4658-
test(1242.1, DT[2,myCol:=6L,with=FALSE], data.table(a=INT(1,6,3), b=4:6), warning="with=FALSE together with := was deprecated in v1.9.4 released Oct 2014. Please")
4658+
test(1242.1, DT[2,myCol:=6L,with=FALSE], error="with=FALSE together with := was deprecated in v1.9.4")
46594659
test(1242.2, DT[2,(myCol):=7L], data.table(a=INT(1,7,3), b=4:6))
46604660

46614661
# consistency of output type of mult, #340
@@ -13953,8 +13953,8 @@ test(1967.42, x[3, rollends = rep(TRUE, 10L)], error = 'rollends must be length
1395313953
test(1967.43, x[ , ..], error = 'symbol .. is invalid')
1395413954
test(1967.44, x[NULL], data.table(NULL))
1395513955
test(1967.45, x[ , NULL], NULL)
13956-
test(1967.46, x[ , 'b' := 6:10, with = FALSE],
13957-
data.table(a = 1:5, b = 6:10), warning = 'with=FALSE ignored')
13956+
test(1967.46, x[ , 'b' := 6:10, with=FALSE], error='with=FALSE together with :=')
13957+
x[, b := 6:10]
1395813958
test(1967.47, x[ , -1L, with = FALSE], data.table(b = 6:10))
1395913959
test(1967.48, x[ , b, .SDcols = 'a'], 6:10,
1396013960
warning = "This j doesn't use .SD")
@@ -20748,15 +20748,19 @@ test(2301.3, DT[order(a, -b, decreasing=c(TRUE, TRUE))], error="Mixing '-' with
2074820748
test(2301.4, DT[order(a, b, decreasing=c(TRUE, TRUE, FALSE))], error="decreasing= has length 3")
2074920749

2075020750
# as.data.table should remove extra attributes from extended data.frames #5699
20751-
x = data.frame(a=c(1,5,3), b=c(2,4,6))
20751+
x = data.frame(a=c(1, 5, 3), b=c(2, 4, 6))
2075220752
class(x) = c("tbl", "data.frame")
2075320753
attr(x, "t1") = "a"
2075420754
as.data.frame.tbl = function(x) {
2075520755
attr(x, "t1") = NULL
2075620756
class(x) = "data.frame"
2075720757
x
2075820758
}
20759-
test(2302, attr(as.data.table(y), "t1"), attr(as.data.frame(y), "t1"))
20759+
test(2302.1, attr(as.data.table(y), "t1"), attr(as.data.frame(y), "t1"))
20760+
class(x) = c("data.frame", "data.table", "data.frame") # #6739
20761+
test(2302.2, attr(as.data.table(y), "t1"), attr(as.data.frame(y), "t1"))
20762+
class(x) = c("data.frame", "data.table") # duplicate class is overkill
20763+
test(2302.3, attr(as.data.table(y), "t1"), attr(as.data.frame(y), "t1"))
2076020764

2076120765
# by=foo(KEY) does not retain key (no way to guarantee monotonic transformation), #5583
2076220766
DT = data.table(a=1:2, key='a')

0 commit comments

Comments
 (0)