Skip to content

Commit b458ef7

Browse files
changed my mind
1 parent bab6909 commit b458ef7

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

R/data.table.R

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,12 @@ replace_dot_alias = function(e) {
128128
}
129129
}
130130

131-
.reassign_extracted_table = function(name, value, err_msg_detail, env = parent.frame(2L)) {
131+
.reassign_extracted_table = function(name, value, env = parent.frame(2L)) {
132132
k = eval(name[[2L]], env, env)
133133
if (is.list(k)) {
134134
origj = j = if (name %iscall% "$") as.character(name[[3L]]) else eval(name[[3L]], env, env)
135135
if (length(j) != 1L) {
136-
stopf(
137-
"Cannot assign with a recursive index of length %d. The syntax %s is only valid when the index i is length 1.",
138-
length(j), err_msg_detail
139-
)
136+
stopf("Invalid set* operation on a recursive index L[[i]] where i has length %d. Chain [[ instead.", length(j))
140137
}
141138
if (is.character(j)) {
142139
j = match(j, names(k))
@@ -1239,7 +1236,7 @@ replace_dot_alias = function(e) {
12391236
if (is.name(name)) {
12401237
assign(as.character(name),x,parent.frame(),inherits=TRUE)
12411238
} else if (.is_simple_extraction(name)) {
1242-
.reassign_extracted_table(name, x, err_msg_detail = "L[[i]][,:=]")
1239+
.reassign_extracted_table(name, x)
12431240
} # TO DO: else if env$<- or list$<-
12441241
}
12451242
}
@@ -2984,7 +2981,7 @@ setDT = function(x, keep.rownames=FALSE, key=NULL, check.names=FALSE) {
29842981
assign(name, x, parent.frame(), inherits=TRUE)
29852982
} else if (.is_simple_extraction(name)) {
29862983
# common case is call from 'lapply()'
2987-
.reassign_extracted_table(name, x, err_msg_detail = "setDT(L[[i]])")
2984+
.reassign_extracted_table(name, x)
29882985
} else if (name %iscall% "get") { # #6725
29892986
# edit 'get(nm, env)' call to be 'assign(nm, x, envir=env)'
29902987
name = match.call(get, name)

0 commit comments

Comments
 (0)