Skip to content

Commit 6ef4629

Browse files
authored
Update data.table.R
1 parent cc8acfa commit 6ef4629

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

R/data.table.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3447,18 +3447,18 @@ assign_to_extracted_target <- function(name, x, parent_env=parent.frame()) {
34473447
# Helper function to handle $ and [[ indexing in list/environment assignments
34483448
handle_list_env_assign <- function(name, x, error_on_missing = TRUE, check_length = TRUE) {
34493449
if (name %iscall% c('$', '[[') && is.name(name[[2L]])) {
3450-
k = eval(name[[2L]], parent.frame(2), parent.frame(2))
3450+
k <- eval(name[[2L]], parent.frame(2), parent.frame(2))
34513451

34523452
if (is.list(k)) {
3453-
origj = j = if (name[[1L]] == "$") as.character(name[[3L]])
3454-
else eval(name[[3L]], parent.frame(2), parent.frame(2))
3453+
origj <- j <- if (name[[1L]] == "$") as.character(name[[3L]])
3454+
else eval(name[[3L]], parent.frame(2), parent.frame(2))
34553455

34563456
if (is.character(j)) {
34573457
if (check_length && length(j) != 1L) {
34583458
stopf("Cannot assign to an under-allocated recursively indexed list -- L[[i]][,:=] syntax is only valid when i is length 1, but its length is %d", length(j))
34593459
}
34603460

3461-
j = match(j, names(k))
3461+
j <- match(j, names(k))
34623462
if (is.na(j)) {
34633463
if (error_on_missing) {
34643464
stopf("Item '%s' not found in names of input list", origj)
@@ -3471,7 +3471,7 @@ handle_list_env_assign <- function(name, x, error_on_missing = TRUE, check_lengt
34713471
.Call(Csetlistelt, k, as.integer(j), x)
34723472
return(TRUE)
34733473
} else if (is.environment(k) && exists(as.character(name[[3L]]), k)) {
3474-
assign(as.character(name[[3L]]), x, k, inherits=FALSE)
3474+
assign(as.character(name[[3L]]), x, k, inherits = FALSE)
34753475
return(TRUE)
34763476
}
34773477
}

0 commit comments

Comments
 (0)