Skip to content
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

Vectors in %in% Fails #1904

Open
latot opened this issue Dec 21, 2023 · 1 comment
Open

Vectors in %in% Fails #1904

latot opened this issue Dec 21, 2023 · 1 comment

Comments

@latot
Copy link

latot commented Dec 21, 2023

Hi, I'm pretty new using vctrs, still I was able to do some basics in a lib, I'm mainly following https://vctrs.r-lib.org/articles/s3-vector.html#equality-and-comparison

Rn, I found that we can't use %in%:

node <- function(x) {
  vctrs::new_vctr(x, class = "node")
}

data <- node(c(1, 2, 3))

data[[1]] %in% data
Error in `as.character()`:
! Can't convert `x` <node> to <character>.
Run `rlang::last_trace()` to see where the error occurred.

Is this the right way to do it? or is a bug?

Thx!

@DavisVaughan
Copy link
Member

We should probably provide a definition for the new mtfrm() S3 generic if we can, used by match() and therefore %in%.

In the meantime you can use vctrs::vec_in() instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants