3 ms·
Idk why, but looking at the traditional base-R functions really hurt my eyes. The inconsistent api (like in gsub, where the string comes last) together with the
by in9 9y ago
Idk why, but looking at the traditional base-R functions really hurt my eyes. The inconsistent api (like in gsub, where the string comes last) together with the unclear naming (very Unixy when you think about it) made it very hard for me when getting starting with R.
Now days I would do the same with the tidyverse equivalents:
my_column %>%
stringr::str_replace_all(" ","") %>%
stringr::str_replace_all("[a-zA-Z]+","") %>%
stringr::str_split("-") %>%
purrr::map(is.numeric) %>%
purrr::map(mean)
- thestephen 9y agoVery nice idea to use the tidyverse equivalents – thanks!