-
Notifications
You must be signed in to change notification settings - Fork 66
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
Comments
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,
|
Is there a way to patch this on the user's side in the meantime? I used a combination of |
FWIW, this also creates problem for me. In my lab we use a lot questionr's |
@DavisVaughan Do you mean the fix is just that |
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: