Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #' Sorts letters in a character string by alphabetical order
- #'
- #' Vectorised
- str_arrange <- function(x){
- x %>%
- stringr::str_split("") %>% # Split string into letters
- purrr::map(~sort(.) %>% paste(collapse = "")) %>% # Sort and re-combine
- as_vector() # Convert list into vector
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement