How do I subset a vector for elements that do not contain a word in a piped operation? (I'm really into piping)
I'm hoping there's some way to invert str_subset
. In the following example, I'd like to just return the second element of x
instead of the elements with hi
in them:
library(stringr)
x <- c("hi", "bye", "hip")
x %>%
str_dup(2) %>% # just an example operation
str_subset("hi") # I want to return the inverse of this
stringi
there isstri_subset_fixed("hi", negate = TRUE)
. It works, I have just tried it. – Elexa