Skip to content

Instantly share code, notes, and snippets.

@njudd
Created July 13, 2024 19:12
Show Gist options
  • Save njudd/fbe7114bc82aa0e368b7f7f315b86577 to your computer and use it in GitHub Desktop.
Save njudd/fbe7114bc82aa0e368b7f7f315b86577 to your computer and use it in GitHub Desktop.
Quickly split a char vector based on a pattern
library(purrr); library(stringr)
map_chr(str_split(df$col2, ", "), 1) # the number indicates the vec you want based on the split
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment