Skip to content

Commit 0b75c8d

Browse files
committed
Remove vec_slice<-()
1 parent 4e91cbe commit 0b75c8d

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

NAMESPACE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ importFrom(pillar,type_sum)
8585
importFrom(pkgconfig,set_config)
8686
importFrom(utils,head)
8787
importFrom(utils,tail)
88-
importFrom(vctrs,"vec_slice<-")
8988
importFrom(vctrs,num_as_location)
9089
importFrom(vctrs,unspecified)
9190
importFrom(vctrs,vec_as_location)

R/subsetting-matrix.R

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ tbl_subassign_matrix <- function(x, j, value, j_arg, value_arg) {
2828

2929
withCallingHandlers(
3030
for (j in col_idx) {
31-
xj <- x[[j]]
32-
vec_slice(xj, cells[[j]]) <- value
33-
x[[j]] <- xj
31+
x[[j]] <- vectbl_assign_matrix(x[[j]], cells[[j]], value)
3432
},
3533

3634
vctrs_error_incompatible_type = function(cnd) {
@@ -63,6 +61,15 @@ cells_to_col_idx <- function(cells) {
6361
col_idx
6462
}
6563

64+
vectbl_assign_matrix <- function(x, i, value) {
65+
d <- dim(x)
66+
dn <- dimnames(x)
67+
x <- vectbl_assign(x, i, value)
68+
dim(x) <- d
69+
dimnames(x) <- dn
70+
x
71+
}
72+
6673
# Errors ------------------------------------------------------------------
6774

6875
error_subset_matrix_must_be_logical <- function(j_arg) {

0 commit comments

Comments
 (0)