Skip to content

Instantly share code, notes, and snippets.

Created October 31, 2017 13:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/de96063783c7e2be395462b447c3982e to your computer and use it in GitHub Desktop.
Save anonymous/de96063783c7e2be395462b447c3982e to your computer and use it in GitHub Desktop.
# original vector
vctseq <- c('1:4', '1:6', '1,5', '1,3,5', '2, 4:8, 10')
# modify strings
vctseqmod <- paste0('c(', vctseq, ')')
# helper function to parse text
# can be done within lapply, as well
fctParse <- function(x){eval(parse(text = paste0(x)))}
# create list of number strings
lstseq <- lapply(vctseqmod, fctParse)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment