I want to know how to extract data that i want without using %in%

I've been wondering to express some other way to extract data without using %in%
but i really don't know the way. i also searched and trying to express
can you help me?

Your question is a little vague, could you give a concrete example to make it clearer? ideally, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

2 Likes

Not sure if applicable for you, but another nice pattern is stringr::str_detect if you're looking at strings and want to keep the ones which include certain patterns.

library(tidyverse)
my_pets <-  tibble(pets = c("dog", "dogs", "puppy", "puppies", "cat", "cats"))
my_pets
my_pets %>%
  filter(pets %>% str_detect("dog|pupp"))

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.