Skip to content

Commit 0578714

Browse files
Remove key<- (#6645)
Co-authored-by: Benjamin Schwendinger <[email protected]>
1 parent 5ecf963 commit 0578714

File tree

6 files changed

+5
-28
lines changed

6 files changed

+5
-28
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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ rowwiseDT(
141141
142142
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.
143143
144+
9. `key<-`, marked as deprecated since 2012 and unusable since v1.15.0, has been fully removed.
145+
144146
# data.table [v1.16.2](https://github.com/Rdatatable/data.table/milestone/35) (9 October 2024)
145147
146148
## BUG FIXES

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: 1 addition & 5 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

man/deprecated.Rd

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

src/assign.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void setselfref(SEXP x) {
3333
R_NilValue, // for identical() to return TRUE. identical() doesn't look at tag and prot
3434
PROTECT(getAttrib(x, R_NamesSymbol)), // to detect if names has been replaced and its tl lost, e.g. setattr(DT,"names",...)
3535
PROTECT(R_MakeExternalPtr( // to avoid an infinite loop in object.size(), if prot=x here
36-
x, // to know if this data.table has been copied by key<-, attr<-, names<-, etc.
36+
x, // to know if this data.table has been copied by attr<-, names<-, etc.
3737
R_NilValue, // this tag and prot currently unused
3838
R_NilValue
3939
))

0 commit comments

Comments
 (0)