Answers for "str_extract all using mutate and toString"

R
0

str_extract all using mutate and toString

library(purrr)
d %>%
   mutate(y = str_extract_all(x, "\\b\\d{2}\\b") %>%
                 map_chr(toString))
# A tibble: 3 x 2
#  x                              y     
#  <chr>                          <chr> 
#1 i am 10 and she is 50          10, 50
#2 he is 32 and i am 22           32, 22
#3 he may be 70 and she may be 99 70, 99
Posted by: Guest on May-13-2021

Browse Popular Code Answers by Language