Skip to content

Commit

Permalink
add drop arg to indexing; resolve #14
Browse files Browse the repository at this point in the history
  • Loading branch information
khusmann committed Oct 12, 2024
1 parent 2ab68b9 commit 0038cf2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/interlaced.R
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ vec_proxy_order.interlacer_interlaced <- function(x, ...) {
# Subsetting --------------------------------------------------------------

#' @export
`[.interlacer_interlaced` <- function(x, i, ...) {
`[.interlacer_interlaced` <- function(x, i, ..., drop) {
if (!missing(...)) {
cli_abort("Can't index interlaced vectors on dimensions greater than 1.")
}
Expand Down
4 changes: 4 additions & 0 deletions tests/testthat/test-interlaced.R
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ test_that("indexing operates on underlying channels", {
# multidimensional indexing errors
expect_error(foo[1, 2])
expect_error(foo[[1, 2]])

# indexing with drop works
expect_equal(foo[, drop = TRUE], foo)
expect_equal(foo[, drop = FALSE], foo)
})

test_that("indexing assignment casts & operates on underlying channels", {
Expand Down

0 comments on commit 0038cf2

Please sign in to comment.