Skip to content

Commit d75d0d3

Browse files
authored
Update data.table.R
1 parent e8eaa40 commit d75d0d3

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

R/data.table.R

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,7 @@ replace_dot_alias = function(e) {
12141214
assign(as.character(name),x,parent.frame(),inherits=TRUE)
12151215
} else if (.is_simple_extraction(name)) {
12161216
assign_to_extracted_target(name, x, parent.frame())
1217-
}
1217+
}
12181218
}
12191219
}
12201220
}
@@ -2953,14 +2953,14 @@ setDT = function(x, keep.rownames=FALSE, key=NULL, check.names=FALSE) {
29532953
stopf("Argument 'x' to 'setDT' should be a 'list', 'data.frame' or 'data.table'")
29542954
}
29552955
if (!is.null(key)) setkeyv(x, key)
2956-
if (is.name(name)) {
2957-
name = as.character(name)
2958-
assign(name, x, parent.frame(), inherits=TRUE)
2959-
} else if (.is_simple_extraction(name)) {
2960-
assign_to_extracted_target(name, x, parent.frame())
2961-
} else if (is.environment(k) && exists(as.character(name[[3L]]), k)) {
2962-
assign(as.character(name[[3L]]), x, k, inherits=FALSE)
2963-
} else if (isS4(k)) {
2956+
if (is.name(name)) {
2957+
name = as.character(name)
2958+
assign(name, x, parent.frame(), inherits = TRUE)
2959+
} else if (.is_simple_extraction(name)) {
2960+
assign_to_extracted_target(name, x, parent.frame())
2961+
} else if (is.environment(k) && exists(as.character(name[[3L]]), k)) {
2962+
assign(as.character(name[[3L]]), x, k, inherits = FALSE)
2963+
} else if (isS4(k)) {
29642964
.Call(CsetS4elt, k, as.character(name[[3L]]), x)
29652965
}
29662966
} else if (name %iscall% "get") { # #6725
@@ -2972,7 +2972,6 @@ setDT = function(x, keep.rownames=FALSE, key=NULL, check.names=FALSE) {
29722972
}
29732973
.Call(CexpandAltRep, x) # issue#2866 and PR#2882
29742974
invisible(x)
2975-
}
29762975

29772976
as_list = function(x) {
29782977
lx = vector("list", 1L)
@@ -3427,7 +3426,7 @@ is_constantish = function(q, check_singleton=FALSE) {
34273426
names(on) = xCols
34283427
list(on = on, ops = idx_op)
34293428
}
3430-
assign_to_extracted_target <- function(name, x, parent_env = parent.frame()) {
3429+
assign_to_extracted_target <- function(name, x, parent_env=parent.frame()) {
34313430
k = eval(name[[2L]], parent_env, parent_env)
34323431
if (is.list(k)) {
34333432
origj = j = if (name[[1L]] == "$") as.character(name[[3L]]) else eval(name[[3L]], parent_env, parent_env)

0 commit comments

Comments
 (0)