# NOT RUN {
dois <- c('10.1371/journal.pone.0087376','10.1371%2Fjournal.pone.0086169',
'10.1371/journal.pone.0102976','10.1371/journal.pone.0105225',
'10.1371/journal.pone.0102722','10.1371/journal.pone.0033693')
res <- ft_get(dois, from='plos')
# if articles in xml format, parse the XML
(out <- ft_serialize(res, to='xml'))
out$plos$data$data[[1]] # the xml
# From XML to JSON
(out <- ft_serialize(res, to='json'))
out$plos$data$data$`10.1371/journal.pone.0087376` # the json
jsonlite::fromJSON(out$plos$data$data$`10.1371/journal.pone.0087376`)
# To a list
out <- ft_serialize(res, to='list')
out$plos$data$data[[4]]
out$plos$data$data[[4]][[2]]$`article-meta`
# To various data stores on disk
## To an .Rds file
ft_serialize(res, to='file')
## To local files using R.cache package
res_rcache <- ft_serialize(res, to='rcache')
## To Redis
res_redis <- ft_serialize(res, to='redis')
# Chain together functions
doi <- '10.1371/journal.pone.0086169'
ft_get(doi, from='plos') %>%
ft_serialize(to='xml') %>%
ft_serialize(to='redis')
# }
Run the code above in your browser using DataLab