Guest User

Untitled

a guest
Jan 20th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. pubmed_cv <- function(fl_nm) {
  2. library(tidyverse)
  3.  
  4. readLines("pubmed_result.txt") %>%
  5. (function(z) z[z != ""]) %>%
  6. (function(cv) {
  7. grep("^[0-9]+?:", trimws(cv)) %>%
  8. list(
  9. beginnings = .,
  10. ends = compose(as.numeric, na.omit)(c(lead(.) - 1, length(cv)))
  11. ) %>%
  12. pmap_chr(~ reduce(cv[.x:.y], paste, .init = ""))
  13. }) %>%
  14. trimws()
  15. }
Add Comment
Please, Sign In to add comment