You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
# basic integer subsets fine with mutliple args
y <- 1:2
y[2, drop = FALSE]
# questionr contains this line of code, works fine here
questionr::wtd.table(y, weights = c(1,1))
# custom integer does not
x <- haven::labelled(c(1:2), labels = c("apples" = 1L, "oranges" = 2L), label = "lab")
x[2, drop = FALSE]
# questionr contains this line of code above and it's breaking things for us in a few areas
questionr::wtd.table(x, weights = c(1,1))
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:
devinrkeane
changed the title
subsetting an S3 vector fails with more than
subsetting an S3 vector fails with multiple arguments
Sep 29, 2023
Is there a way to patch this on the user's side in the meantime? I used a combination of unlockBinding() and assign() to overwrite [.vctrs_vctr but there might be cleaner solutions.
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: