Skip to content

Instantly share code, notes, and snippets.

@danielecook
Created June 6, 2020 15:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielecook/3e836670673dc1101bb4a9c22dd5f0ca to your computer and use it in GitHub Desktop.
Save danielecook/3e836670673dc1101bb4a9c22dd5f0ca to your computer and use it in GitHub Desktop.
vectorize a string list; Useful for setting constants
# ITEMS <- vectorize("
# a
# b
# c
# ")
vectorize <- function(x) {
x <- strsplit(x, "\n")[[1]]
x[!is.na(x) & x != ""]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment