String Manipulation with stringr in R
Charlotte Wickham
Assistant Professor at Oregon State University
str_detect()str_subset()str_count()pizzas <- c("cheese", "pepperoni", "sausage and green peppers")str_detect(string = pizzas, pattern = "pepper")
FALSE TRUE TRUE
str_detect(string = pizzas, pattern = fixed("pepper"))
FALSE TRUE TRUE
str_subset(string = pizzas, pattern = fixed("pepper"))
"pepperoni" "sausage and green peppers"
str_count(string = pizzas, pattern = fixed("pepper"))
0 1 1
String Manipulation with stringr in R