Created
June 6, 2020 15:26
-
-
Save danielecook/3e836670673dc1101bb4a9c22dd5f0ca to your computer and use it in GitHub Desktop.
vectorize a string list; Useful for setting constants
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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