hi I want to make sure this code below is filtering only for "size" where there are 3 alphabetical letters: (ABC, CHA, AJI) ... "A3Z' and " 44k" etc are gone. thank you ! <3
data %>% filter(str_detrect(size, pattern = "[:alpha:]{3}"))
hi I want to make sure this code below is filtering only for "size" where there are 3 alphabetical letters: (ABC, CHA, AJI) ... "A3Z' and " 44k" etc are gone. thank you ! <3
data %>% filter(str_detrect(size, pattern = "[:alpha:]{3}"))
It would work. You had str_detrect
instead of str_detect
library(tidyverse)
data <- tibble(size = c("ABC", "CHA", "AJI", "A3Z", "44k"))
data %>%
filter(str_detect(size, pattern = "[:alpha:]{3}"))
# A tibble: 3 x 1
size
<chr>
1 ABC
2 CHA
3 AJI
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.