Skip to content

Instantly share code, notes, and snippets.

@sckott
Last active August 29, 2015 14:13
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 sckott/31bf9c6772038a704f95 to your computer and use it in GitHub Desktop.
Save sckott/31bf9c6772038a704f95 to your computer and use it in GitHub Desktop.

another fulltext example? Yeppers!

This time, let's visualize publishing history across lots of papers (1000 in this case)

Installation, loading

install.packages("devtools")
devtools::install_github("ropensci/fulltext")
library("fulltext")
library("ggplot2")
library("dplyr")

the example

Get some data

opts <- list(fq=list('doc_type:full',"article_type:\"research article\""))
x <- ft_search(query='ecology', from='plos', limit=1000, plosopts = opts)$plos$data$id %>% 
  ft_get(from = "plos") 

Get history data, add new column, then plot

x %>% 
  chunks(c("doi","history")) %>% 
  tabularize() %>% 
  .$plos %>% 
  mutate(diff = as.numeric(history.accepted-history.received)) %>% 
  ggplot(aes(x = diff)) +
    geom_histogram(binwidth = 10) +
    theme_grey(base_size = 20) +
    labs(x="Days between recieved and accepted")

img

booya! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment