Full text

Search functions in rplos can be used to get back full text in addition to any section of an article. However, if you prefer XML, this vignette is for you.

Load package from CRAN

install.packages("rplos")
library('rplos')

Get full text URLs

Create urls for full text articles in PLOS journals

Here's the URL for XML full text for the DOI 10.1371/journal.pone.0086169

full_text_urls(doi = '10.1371/journal.pone.0086169')
#> [1] "http://journals.plos.org/plosone/article/file?id=10.1371/journal.pone.0086169&type=manuscript"

And for the DOI 10.1371/journal.pbio.1001845

full_text_urls(doi = '10.1371/journal.pbio.1001845')
#> [1] "http://journals.plos.org/plosbiology/article/file?id=10.1371/journal.pbio.1001845&type=manuscript"

The function is vectorized, so you can pass in many DOIs

full_text_urls(doi = c('10.1371/journal.pone.0086169', 
                       '10.1371/journal.pbio.1001845'))
#> [1] "http://journals.plos.org/plosone/article/file?id=10.1371/journal.pone.0086169&type=manuscript"    
#> [2] "http://journals.plos.org/plosbiology/article/file?id=10.1371/journal.pbio.1001845&type=manuscript"

Use searchplos() to get a lot of DOIs, then get the URLs for full text XML

dois <- searchplos(q = "*:*", fq = 'doc_type:full', limit = 20)$data$id
full_text_urls(dois)
#>  [1] "http://journals.plos.org/ploscompbiol/article/file?id=10.1371/journal.pcbi.0020071&type=manuscript"
#>  [2] "http://journals.plos.org/plosbiology/article/file?id=10.1371/journal.pbio.1000152&type=manuscript" 
#>  [3] "http://journals.plos.org/plosbiology/article/file?id=10.1371/journal.pbio.1000153&type=manuscript" 
#>  [4] "http://journals.plos.org/plosbiology/article/file?id=10.1371/journal.pbio.1000159&type=manuscript" 
#>  [5] "http://journals.plos.org/plosbiology/article/file?id=10.1371/journal.pbio.1000165&type=manuscript" 
#>  [6] "http://journals.plos.org/plosbiology/article/file?id=10.1371/journal.pbio.1000166&type=manuscript" 
#>  [7] "http://journals.plos.org/plosbiology/article/file?id=10.1371/journal.pbio.1000167&type=manuscript" 
#>  [8] "http://journals.plos.org/plosbiology/article/file?id=10.1371/journal.pbio.1000173&type=manuscript" 
#>  [9] "http://journals.plos.org/plosbiology/article/file?id=10.1371/journal.pbio.1000175&type=manuscript" 
#> [10] "http://journals.plos.org/plosbiology/article/file?id=10.1371/journal.pbio.1000176&type=manuscript" 
#> [11] "http://journals.plos.org/ploscompbiol/article/file?id=10.1371/journal.pcbi.0030121&type=manuscript"
#> [12] "http://journals.plos.org/ploscompbiol/article/file?id=10.1371/journal.pcbi.0030124&type=manuscript"
#> [13] "http://journals.plos.org/ploscompbiol/article/file?id=10.1371/journal.pcbi.0030125&type=manuscript"
#> [14] "http://journals.plos.org/ploscompbiol/article/file?id=10.1371/journal.pcbi.0030127&type=manuscript"
#> [15] "http://journals.plos.org/ploscompbiol/article/file?id=10.1371/journal.pcbi.0030130&type=manuscript"
#> [16] "http://journals.plos.org/plosbiology/article/file?id=10.1371/journal.pbio.1000409&type=manuscript" 
#> [17] "http://journals.plos.org/plosbiology/article/file?id=10.1371/journal.pbio.1000410&type=manuscript" 
#> [18] "http://journals.plos.org/plosbiology/article/file?id=10.1371/journal.pbio.1000411&type=manuscript" 
#> [19] "http://journals.plos.org/plosbiology/article/file?id=10.1371/journal.pbio.1000414&type=manuscript" 
#> [20] "http://journals.plos.org/plosbiology/article/file?id=10.1371/journal.pbio.1000421&type=manuscript"

Get XML

Get full text XML of PLOS papers given a DOI

plos_fulltext(doi = '10.1371/journal.pone.0086169')
#> 1 full-text articles retrieved 
#> Min. Length: 110717 - Max. Length: 110717 
#> DOIs: 10.1371/journal.pone.0086169 ... 
#> 
#> NOTE: extract xml strings like output['<doi>']

plos_fulltext() is vectorized, so you can pass in more than one DOI

plos_fulltext(c('10.1371/journal.pone.0086169','10.1371/journal.pbio.1001845'))
#> 2 full-text articles retrieved 
#> Min. Length: 110717 - Max. Length: 143442 
#> DOIs: 10.1371/journal.pone.0086169 10.1371/journal.pbio.1001845 ... 
#> 
#> NOTE: extract xml strings like output['<doi>']

Get many DOIs, then index to get the full XML of the one you want (output not shown)

dois <- searchplos(q = "*:*", fq = 'doc_type:full', limit = 3)$data$id
out <- plos_fulltext(dois)
xml <- out[dois[1]][[1]]

Extract the abstract from the XML

if (requireNamespace("xml2")) {
  library("xml2")
  xml_text(xml_find_all(read_xml(xml), "//abstract"))
}
#> [1] "With the burgeoning immunological data in the scientific literature, scientists must increasingly rely on Internet resources to inform and enhance their work. Here we provide a brief overview of the adaptive immune response and summaries of immunoinformatics resources, emphasizing those with Web interfaces. These resources include searchable databases of epitopes and immune-related molecules, and analysis tools for T cell and B cell epitope prediction, vaccine design, and protein structure comparisons. There is an agreeable synergy between the growing collections in immune-related databases and the growing sophistication of analysis software; the databases provide the foundation for developing predictive computational tools, which in turn enable more rapid identification of immune responses to populate the databases. Collectively, these resources contribute to improved understanding of immune responses and escape, and evolution of pathogens under immune pressure. The public health implications are vast, including designing vaccines, understanding autoimmune diseases, and defining the correlates of immune protection."

Extract reference lists, just give back first few for brevity

if (requireNamespace("xml2")) {
  library("xml2")
  xml_find_all(read_xml(out[[3]]), "//ref-list/ref")[1:2]
}
#> {xml_nodeset (2)}
#> [1] <ref id="pbio.1000153-Fetz1">\n  <label>1</label>\n  <element-citation pu ...
#> [2] <ref id="pbio.1000153-Wessberg1">\n  <label>2</label>\n  <element-citatio ...


Try the rplos package in your browser

Any scripts or data that you put into this service are public.

rplos documentation built on Feb. 24, 2021, 1:06 a.m.