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
This is pretty simple to do but this could potentially be a nice helper function. When mapping over elements of a vector, the attributes are lost before the function is applied:
library(purrr)
library(stringr)
keywords=stringr::coll(c("FOO", "BAR", "BAZ"), ignore_case=TRUE)
words= c("fuzz", "foo", "boat", "baz")
# stringr_pattern class is lost before str_detect is applied
map_lgl(keywords, function(x) any(stringr::str_detect(words, x)))
#> FALSE FALSE FALSE
It might be nice to have a helper function that applies the attributes of the input to each element, e.g.
The text was updated successfully, but these errors were encountered:
mkoohafkan
changed the title
apply attributes to map elements
apply overall attributes to vector elements before mapping
Oct 27, 2023
mkoohafkan
changed the title
apply overall attributes to vector elements before mapping
apply attributes to individual vector elements before mapping
Oct 27, 2023
This is pretty simple to do but this could potentially be a nice helper function. When mapping over elements of a vector, the attributes are lost before the function is applied:
It might be nice to have a helper function that applies the attributes of the input to each element, e.g.
The text was updated successfully, but these errors were encountered: