From 81ba8de4d4b2d74d8f13a49c59039f9c31e81239 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 31 Jul 2021 06:47:14 +0200 Subject: [PATCH 1/4] Extract variable before return --- R/subsetting.R | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/R/subsetting.R b/R/subsetting.R index 0819746da..3c205b32e 100644 --- a/R/subsetting.R +++ b/R/subsetting.R @@ -179,7 +179,8 @@ NULL value <- list(value) names(value) <- names(j) - tbl_subassign(x, i, j, value, i_arg = i_arg, j_arg = j_arg, value_arg = value_arg) + out <- tbl_subassign(x, i, j, value, i_arg = i_arg, j_arg = j_arg, value_arg = value_arg) + out } @@ -288,7 +289,8 @@ NULL } } - tbl_subassign(x, i, j, value, i_arg, j_arg, substitute(value)) + out <- tbl_subassign(x, i, j, value, i_arg, j_arg, substitute(value)) + out } vectbl_as_row_index <- function(i, x, i_arg, assign = FALSE) { From 02b3617edab3bdbb3daaf56ae27688011c335df2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 31 Jul 2021 06:47:24 +0200 Subject: [PATCH 2/4] Simplify --- R/subsetting.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/R/subsetting.R b/R/subsetting.R index 3c205b32e..a775ea5c4 100644 --- a/R/subsetting.R +++ b/R/subsetting.R @@ -228,10 +228,10 @@ NULL } # From here on, i, j and drop contain correct values: - xo <- x - - if (!is.null(j)) { - j <- vectbl_as_col_location(j, length(xo), names(xo), j_arg = j_arg, assign = FALSE) + if (is.null(j)) { + xo <- x + } else { + j <- vectbl_as_col_location(j, length(x), names(x), j_arg = j_arg, assign = FALSE) if (anyNA(j)) { cnd_signal(error_na_column_index(which(is.na(j)))) From e5039bab2b92aa20385978049175fb7680864219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 31 Jul 2021 07:08:36 +0200 Subject: [PATCH 3/4] Clean up --- R/subsetting.R | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/R/subsetting.R b/R/subsetting.R index a775ea5c4..fed808d58 100644 --- a/R/subsetting.R +++ b/R/subsetting.R @@ -130,7 +130,8 @@ NULL if (is.null(x)) { x } else { - vectbl_strip_names(vec_slice(x, i)) + # Drop inner names with double subscript + vec_set_names(vec_slice(x, i), NULL) } } } @@ -684,18 +685,6 @@ vectbl_assign <- function(x, i, value) { vec_assign(x, i, value) } -vectbl_strip_names <- function(x) { - maybe_row_names <- is.data.frame(x) || is.array(x) - - if (maybe_row_names) { - row.names(x) <- NULL - } else { - names(x) <- NULL - } - - x -} - vectbl_wrap_rhs_col <- function(value, value_arg) { if (is.null(value)) { return(list(value)) From 84bd9c09068549736dadcde6c9a92f027c47c843 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 31 Jul 2021 07:22:56 +0200 Subject: [PATCH 4/4] Revert "Extract variable before return" This reverts commit 81ba8de4d4b2d74d8f13a49c59039f9c31e81239. --- R/subsetting.R | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/R/subsetting.R b/R/subsetting.R index fed808d58..1fa4664da 100644 --- a/R/subsetting.R +++ b/R/subsetting.R @@ -180,8 +180,7 @@ NULL value <- list(value) names(value) <- names(j) - out <- tbl_subassign(x, i, j, value, i_arg = i_arg, j_arg = j_arg, value_arg = value_arg) - out + tbl_subassign(x, i, j, value, i_arg = i_arg, j_arg = j_arg, value_arg = value_arg) } @@ -290,8 +289,7 @@ NULL } } - out <- tbl_subassign(x, i, j, value, i_arg, j_arg, substitute(value)) - out + tbl_subassign(x, i, j, value, i_arg, j_arg, substitute(value)) } vectbl_as_row_index <- function(i, x, i_arg, assign = FALSE) {