Skip to content

Commit f3151de

Browse files
authored
Merge pull request #930 from tidyverse/f-890-refactor-2
2 parents 9e1e32f + 84bd9c0 commit f3151de

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

R/subsetting.R

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ NULL
130130
if (is.null(x)) {
131131
x
132132
} else {
133-
vectbl_strip_names(vec_slice(x, i))
133+
# Drop inner names with double subscript
134+
vec_set_names(vec_slice(x, i), NULL)
134135
}
135136
}
136137
}
@@ -227,10 +228,10 @@ NULL
227228
}
228229

229230
# From here on, i, j and drop contain correct values:
230-
xo <- x
231-
232-
if (!is.null(j)) {
233-
j <- vectbl_as_col_location(j, length(xo), names(xo), j_arg = j_arg, assign = FALSE)
231+
if (is.null(j)) {
232+
xo <- x
233+
} else {
234+
j <- vectbl_as_col_location(j, length(x), names(x), j_arg = j_arg, assign = FALSE)
234235

235236
if (anyNA(j)) {
236237
cnd_signal(error_na_column_index(which(is.na(j))))
@@ -682,18 +683,6 @@ vectbl_assign <- function(x, i, value) {
682683
vec_assign(x, i, value)
683684
}
684685

685-
vectbl_strip_names <- function(x) {
686-
maybe_row_names <- is.data.frame(x) || is.array(x)
687-
688-
if (maybe_row_names) {
689-
row.names(x) <- NULL
690-
} else {
691-
names(x) <- NULL
692-
}
693-
694-
x
695-
}
696-
697686
vectbl_wrap_rhs_col <- function(value, value_arg) {
698687
if (is.null(value)) {
699688
return(list(value))

0 commit comments

Comments
 (0)