-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
subsetting an S3 vector fails with multiple arguments #1880
Labels
bug
an unexpected problem or unintended behavior
Comments
devinrkeane
changed the title
subsetting an S3 vector fails with more than
subsetting an S3 vector fails with multiple arguments
Sep 29, 2023
I think it is a bug on our end. I think it is because > vctrs:::`[.vctrs_vctr`
function (x, i, ...)
{
vec_index(x, i, ...)
} doesn't have a named argument for > vctrs:::vec_index
function (x, i, ...)
{
i <- maybe_missing(i, TRUE)
out <- vec_slice(x, i)
if (!dots_n(...)) {
return(out)
}
proxy <- vec_data(out)
out <- proxy[, ..., drop = FALSE]
vec_restore(out, x)
} so we end up doing something like this: > vctrs:::vec_index(1:2, 2, drop = FALSE)
Error in proxy[, ..., drop = FALSE] : incorrect number of dimensions or, more simply: > x <- 1:2
> x[, drop = FALSE, drop = FALSE]
Error in x[, drop = FALSE, drop = FALSE] : incorrect number of dimensions |
thanks! Makes sense, that's where i ended up too in my debugging,
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
we recently created a custom S3 vector class to handle categorical data and are running into issues whenever this vector encounters base subsetting beyond a single dimension or argument.
Our class is similar to haven's
labelled
class and I provided an example where this gets us:Is this desired behavior and if so, should we be messaging to the user what the issue is or what we should be avoiding? This seems to be a flaw but i dont have a deep understanding of the vctrs theory, so any guidance here would be appreciated.
We're on 4.1.3, up to date with vctrs (0.6.3).
The text was updated successfully, but these errors were encountered: