-
Notifications
You must be signed in to change notification settings - Fork 273
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
vec_depth fails if list has values of class "name" #818
Comments
Somewhat more minimal reprex: purrr::vec_depth(list(x = quote(x)))
#> Error in `.f()` at purrr/R/map.R:204:2:
#> ! `x` must be a vector Created on 2022-08-24 by the reprex package (v2.0.1) It feels like the final |
Maybe this should be |
If making a function to do the task as described in the example, that would certainly make sense as a name! |
And generalise to handle more types of input. Fixes #818
Hi Team
purrr
,Grateful for the work ya'll have done on this package. I've used
purrr
- 974 times since I first became aware of it. Needless to say, it's an essential part of my R toolkit - so thank you!I'm actually trying to come up with a solution for Advanced R 18.5.3 Q4 and have just used
rapply
to convert an expression to a series of lists with:.calls <- rapply(as.list(x), as.list, classes = "call", how = "list")
I would like to map over the resulting list using
purrr
with something like the following:purrr::map_depth(.calls, purrr::vec_depth(.calls), call_match_lgl, pattern = "fn")
But I'm finding that an element of class
name
apparently causesvec_depth
to error.Here's a simple reprex to illustrate:
It seems like modifying it like this might make it return results match with what one would expect when visualizing with
lobstr::ast
:There might be some exceptions where this would have unexpected results though.
Thoughts?
The text was updated successfully, but these errors were encountered: