{"id":13994262,"url":"https://github.com/ropensci-archive/rplos","last_synced_at":"2025-07-22T19:31:34.939Z","repository":{"id":1536432,"uuid":"1834988","full_name":"ropensci-archive/rplos","owner":"ropensci-archive","description":":warning: ARCHIVED :warning: R client for the PLoS Journals API","archived":true,"fork":false,"pushed_at":"2022-09-09T12:06:05.000Z","size":5057,"stargazers_count":313,"open_issues_count":0,"forks_count":106,"subscribers_count":69,"default_branch":"master","last_synced_at":"2024-08-10T14:15:30.207Z","etag":null,"topics":["metadata","pdf","plos","r","r-package","rstats","text-mining","web-api","xml"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"CyanogenMod/android_packages_apps_Camera","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ropensci-archive.png","metadata":{"files":{"readme":"README-not.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-06-02T01:06:42.000Z","updated_at":"2024-07-21T07:43:40.000Z","dependencies_parsed_at":"2023-01-11T16:04:29.055Z","dependency_job_id":null,"html_url":"https://github.com/ropensci-archive/rplos","commit_stats":null,"previous_names":["ropensci/rplos"],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci-archive%2Frplos","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci-archive%2Frplos/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci-archive%2Frplos/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci-archive%2Frplos/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ropensci-archive","download_url":"https://codeload.github.com/ropensci-archive/rplos/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227166610,"owners_count":17740949,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["metadata","pdf","plos","r","r-package","rstats","text-mining","web-api","xml"],"created_at":"2024-08-09T14:02:47.639Z","updated_at":"2024-11-29T16:30:52.935Z","avatar_url":"https://github.com/ropensci-archive.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"rplos\n=====\n\n\n\n[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)\n[![cran checks](https://cranchecks.info/badges/worst/rplos)](https://cranchecks.info/pkgs/rplos)\n[![R-check](https://github.com/ropensci/rplos/workflows/R-check/badge.svg)](https://github.com/ropensci/rplos/actions?query=workflow%3AR-check)\n[![codecov.io](https://codecov.io/github/ropensci/rplos/coverage.svg?branch=master)](https://codecov.io/github/ropensci/rplos?branch=master)\n[![rstudio mirror downloads](https://cranlogs.r-pkg.org/badges/rplos)](https://github.com/r-hub/cranlogs.app)\n[![cran version](https://www.r-pkg.org/badges/version/rplos)](https://cran.r-project.org/package=rplos)\n\n## Install\n\nYou can get this package at CRAN [here](https://cran.r-project.org/package=rplos), or install it within R by doing\n\n\n```r\ninstall.packages(\"rplos\")\n```\n\nOr install the development version from GitHub\n\n\n```r\nremotes::install_github(\"ropensci/rplos\")\n```\n\n\n```r\nlibrary(\"rplos\")\n```\n\n## What is this?\n\n`rplos` is a package for accessing full text articles from the Public Library of Science journals using their API.\n\n## Information\n\nYou used to need a key to use `rplos` - you no longer do as of 2015-01-13 (or `v0.4.5.999`).\n\nrplos vignetttes: \u003chttps://docs.ropensci.org/rplos/\u003e\n\nPLOS API documentation: \u003chttp://api.plos.org/\u003e\n\nPLOS Solr schema is at \u003chttps://gist.github.com/openAccess/9e76aa7fa6135be419968b1372c86957\u003e but is 1.5 years old so may not be up to date.\n\nCrossref API documentation can be found at \u003chttps://github.com/CrossRef/rest-api-doc\u003e. See also [rcrossref](https://github.com/ropensci/rcrossref) ([on CRAN](https://cran.r-project.org/package=rcrossref)) with a much fuller implementation of R functions for all Crossref endpoints.\n\n## Throttling\n\nBeware, PLOS recently has started throttling requests. That is,\nthey will give error messages like \"(503) Service Unavailable -\nThe server cannot process the request due to a high load\", which\nmeans you've done too many requests in a certain time period. Here's\n[what they say](http://api.plos.org/solr/faq/#solr_api_recommended_usage) on the matter:\n\n\u003e Please limit your API requests to 7200 requests a day, 300 per hour, 10 per minute and allow 5 seconds for your search to return results. If you exceed this threshold, we will lock out your IP address. If you're a high-volume user of the PLOS Search API and need more API requests a day, please contact us at api@plos.org to discuss your options. We currently limit API users to no more than five concurrent connections from a single IP address.\n\n## Quick start\n\n### Search\n\nSearch for the term ecology, and return id (DOI) and publication date, limiting to 5 items\n\n\n```r\nsearchplos('ecology', 'id,publication_date', limit = 5)\n#\u003e $meta\n#\u003e # A tibble: 1 x 2\n#\u003e   numFound start\n#\u003e      \u003cint\u003e \u003cint\u003e\n#\u003e 1    55873     0\n#\u003e \n#\u003e $data\n#\u003e # A tibble: 5 x 2\n#\u003e   id                           publication_date    \n#\u003e   \u003cchr\u003e                        \u003cchr\u003e               \n#\u003e 1 10.1371/journal.pone.0001248 2007-11-28T00:00:00Z\n#\u003e 2 10.1371/journal.pone.0059813 2013-04-24T00:00:00Z\n#\u003e 3 10.1371/journal.pone.0080763 2013-12-10T00:00:00Z\n#\u003e 4 10.1371/journal.pone.0246749 2021-02-08T00:00:00Z\n#\u003e 5 10.1371/journal.pone.0220747 2019-08-01T00:00:00Z\n```\n\nGet DOIs for full article in PLoS One\n\n\n```r\nsearchplos(q=\"*:*\", fl='id', fq=list('journal_key:PLoSONE',\n   'doc_type:full'), limit=5)\n#\u003e $meta\n#\u003e # A tibble: 1 x 2\n#\u003e   numFound start\n#\u003e      \u003cint\u003e \u003cint\u003e\n#\u003e 1   246927     0\n#\u003e \n#\u003e $data\n#\u003e # A tibble: 5 x 1\n#\u003e   id                          \n#\u003e   \u003cchr\u003e                       \n#\u003e 1 10.1371/journal.pone.0002399\n#\u003e 2 10.1371/journal.pone.0002401\n#\u003e 3 10.1371/journal.pone.0002403\n#\u003e 4 10.1371/journal.pone.0002405\n#\u003e 5 10.1371/journal.pone.0002407\n```\n\nQuery to get some PLOS article-level metrics, notice difference between two outputs\n\n\n```r\nout \u003c- searchplos(q=\"*:*\", fl=c('id','counter_total_all','alm_twitterCount'), fq='doc_type:full')\nout_sorted \u003c- searchplos(q=\"*:*\", fl=c('id','counter_total_all','alm_twitterCount'),\n   fq='doc_type:full', sort='counter_total_all desc')\nhead(out$data)\n#\u003e # A tibble: 6 x 3\n#\u003e   id                           alm_twitterCount counter_total_all\n#\u003e   \u003cchr\u003e                                   \u003cint\u003e             \u003cint\u003e\n#\u003e 1 10.1371/journal.pcbi.0020071                0             17862\n#\u003e 2 10.1371/journal.pbio.1000152                0              7180\n#\u003e 3 10.1371/journal.pbio.1000153                5             27702\n#\u003e 4 10.1371/journal.pbio.1000159                0             14256\n#\u003e 5 10.1371/journal.pbio.1000165                8             30629\n#\u003e 6 10.1371/journal.pbio.1000166                0              6884\nhead(out_sorted$data)\n#\u003e # A tibble: 6 x 3\n#\u003e   id                           alm_twitterCount counter_total_all\n#\u003e   \u003cchr\u003e                                   \u003cint\u003e             \u003cint\u003e\n#\u003e 1 10.1371/journal.pmed.0020124             3890           3226572\n#\u003e 2 10.1371/journal.pone.0133079              312           2481307\n#\u003e 3 10.1371/journal.pcbi.1003149              216           1766230\n#\u003e 4 10.1371/journal.pmed.1000376                9           1213573\n#\u003e 5 10.1371/journal.pone.0141854             3804            996693\n#\u003e 6 10.1371/journal.pcbi.0030102               65            986338\n```\n\nA list of articles about social networks that are popular on a social network\n\n\n```r\nsearchplos(q=\"*:*\",fl=c('id','alm_twitterCount'),\n   fq=list('doc_type:full','subject:\"Social networks\"','alm_twitterCount:[100 TO 10000]'),\n   sort='counter_total_month desc')\n#\u003e $meta\n#\u003e # A tibble: 1 x 2\n#\u003e   numFound start\n#\u003e      \u003cint\u003e \u003cint\u003e\n#\u003e 1       64     0\n#\u003e \n#\u003e $data\n#\u003e # A tibble: 10 x 2\n#\u003e    id                           alm_twitterCount\n#\u003e    \u003cchr\u003e                                   \u003cint\u003e\n#\u003e  1 10.1371/journal.pmed.1000316             1199\n#\u003e  2 10.1371/journal.pone.0069841              896\n#\u003e  3 10.1371/journal.pone.0073791             1884\n#\u003e  4 10.1371/journal.pcbi.1005399              604\n#\u003e  5 10.1371/journal.pcbi.1007513              122\n#\u003e  6 10.1371/journal.pone.0236517              123\n#\u003e  7 10.1371/journal.pbio.1002195              778\n#\u003e  8 10.1371/journal.pone.0118093              133\n#\u003e  9 10.1371/journal.pone.0155923              200\n#\u003e 10 10.1371/journal.pone.0162678              172\n```\n\nShow all articles that have these two words less then about 15 words apart\n\n\n```r\nsearchplos(q='everything:\"sports alcohol\"~15', fl='title', fq='doc_type:full', limit=3)\n#\u003e $meta\n#\u003e # A tibble: 1 x 2\n#\u003e   numFound start\n#\u003e      \u003cint\u003e \u003cint\u003e\n#\u003e 1      163     0\n#\u003e \n#\u003e $data\n#\u003e # A tibble: 3 x 1\n#\u003e   title                                                                         \n#\u003e   \u003cchr\u003e                                                                         \n#\u003e 1 Alcohol Advertising in Sport and Non-Sport TV in Australia, during Children’s…\n#\u003e 2 Alcohol intoxication at Swedish football matches: A study using biological sa…\n#\u003e 3 Symptoms of Insomnia and Sleep Duration and Their Association with Incident S…\n```\n\nNarrow results to 7 words apart, changing the ~15 to ~7\n\n\n```r\nsearchplos(q='everything:\"sports alcohol\"~7', fl='title', fq='doc_type:full', limit=3)\n#\u003e $meta\n#\u003e # A tibble: 1 x 2\n#\u003e   numFound start\n#\u003e      \u003cint\u003e \u003cint\u003e\n#\u003e 1       91     0\n#\u003e \n#\u003e $data\n#\u003e # A tibble: 3 x 1\n#\u003e   title                                                                         \n#\u003e   \u003cchr\u003e                                                                         \n#\u003e 1 Alcohol Advertising in Sport and Non-Sport TV in Australia, during Children’s…\n#\u003e 2 Alcohol intoxication at Swedish football matches: A study using biological sa…\n#\u003e 3 Symptoms of Insomnia and Sleep Duration and Their Association with Incident S…\n```\n\nRemove DOIs for annotations (i.e., corrections) and Viewpoints articles\n\n\n```r\nsearchplos(q='*:*', fl=c('id','article_type'),\n   fq=list('-article_type:correction','-article_type:viewpoints'), limit=5)\n#\u003e $meta\n#\u003e # A tibble: 1 x 2\n#\u003e   numFound start\n#\u003e      \u003cint\u003e \u003cint\u003e\n#\u003e 1  2434439     0\n#\u003e \n#\u003e $data\n#\u003e # A tibble: 5 x 2\n#\u003e   id                                                  article_type    \n#\u003e   \u003cchr\u003e                                               \u003cchr\u003e           \n#\u003e 1 10.1371/journal.pbio.1000146/title                  Unsolved Mystery\n#\u003e 2 10.1371/journal.pbio.1000146/abstract               Unsolved Mystery\n#\u003e 3 10.1371/journal.pbio.1000146/references             Unsolved Mystery\n#\u003e 4 10.1371/journal.pbio.1000146/body                   Unsolved Mystery\n#\u003e 5 10.1371/journal.pbio.1000146/supporting_information Unsolved Mystery\n```\n\n### Faceted search\n\nFacet on multiple fields\n\n\n```r\nfacetplos(q='alcohol', facet.field=c('journal','subject'), facet.limit=5)\n#\u003e $facet_queries\n#\u003e NULL\n#\u003e \n#\u003e $facet_fields\n#\u003e $facet_fields$journal\n#\u003e # A tibble: 5 x 2\n#\u003e   term                             value\n#\u003e   \u003cchr\u003e                            \u003cchr\u003e\n#\u003e 1 plos one                         31656\n#\u003e 2 plos genetics                    702  \n#\u003e 3 plos medicine                    699  \n#\u003e 4 plos neglected tropical diseases 637  \n#\u003e 5 plos pathogens                   459  \n#\u003e \n#\u003e $facet_fields$subject\n#\u003e # A tibble: 5 x 2\n#\u003e   term                          value\n#\u003e   \u003cchr\u003e                         \u003cchr\u003e\n#\u003e 1 biology and life sciences     33275\n#\u003e 2 medicine and health sciences  30309\n#\u003e 3 research and analysis methods 17340\n#\u003e 4 biochemistry                  14587\n#\u003e 5 physical sciences             12502\n#\u003e \n#\u003e \n#\u003e $facet_pivot\n#\u003e NULL\n#\u003e \n#\u003e $facet_dates\n#\u003e NULL\n#\u003e \n#\u003e $facet_ranges\n#\u003e NULL\n```\n\nRange faceting\n\n\n```r\nfacetplos(q='*:*', url=url, facet.range='counter_total_all',\n facet.range.start=5, facet.range.end=100, facet.range.gap=10)\n#\u003e $facet_queries\n#\u003e NULL\n#\u003e \n#\u003e $facet_fields\n#\u003e NULL\n#\u003e \n#\u003e $facet_pivot\n#\u003e NULL\n#\u003e \n#\u003e $facet_dates\n#\u003e NULL\n#\u003e \n#\u003e $facet_ranges\n#\u003e $facet_ranges$counter_total_all\n#\u003e # A tibble: 10 x 2\n#\u003e    term  value\n#\u003e    \u003cchr\u003e \u003cchr\u003e\n#\u003e  1 5     39   \n#\u003e  2 15    12   \n#\u003e  3 25    33   \n#\u003e  4 35    47   \n#\u003e  5 45    47   \n#\u003e  6 55    44   \n#\u003e  7 65    59   \n#\u003e  8 75    80   \n#\u003e  9 85    114  \n#\u003e 10 95    136\n```\n\n### Highlight searches\n\nSearch for and highlight the term _alcohol_ in the abstract field only\n\n\n```r\n(out \u003c- highplos(q='alcohol', hl.fl = 'abstract', rows=3))\n#\u003e $`10.1371/journal.pone.0218147`\n#\u003e $`10.1371/journal.pone.0218147`$abstract\n#\u003e [1] \"Background: Binge drinking, an increasingly common form of \u003cem\u003ealcohol\u003c/em\u003e use disorder, is associated\"\n#\u003e \n#\u003e \n#\u003e $`10.1371/journal.pone.0138021`\n#\u003e $`10.1371/journal.pone.0138021`$abstract\n#\u003e [1] \"Background and Aim: Harmful \u003cem\u003ealcohol\u003c/em\u003e consumption has long been recognized as being the major\"\n#\u003e \n#\u003e \n#\u003e $`10.1371/journal.pone.0201042`\n#\u003e $`10.1371/journal.pone.0201042`$abstract\n#\u003e [1] \"\\nAcute \u003cem\u003ealcohol\u003c/em\u003e administration can lead to a loss of control over drinking. Several models argue\"\n```\n\nAnd you can browse the results in your default browser\n\n\n```r\nhighbrow(out)\n```\n\n![highbrow](man/figures/highbrow.png)\n\n### Full text urls\n\nSimple function to get full text urls for a DOI\n\n\n```r\nfull_text_urls(doi='10.1371/journal.pone.0086169')\n#\u003e [1] \"http://journals.plos.org/plosone/article/file?id=10.1371/journal.pone.0086169\u0026type=manuscript\"\n```\n\n### Full text xml given a DOI\n\n\n```r\n(out \u003c- plos_fulltext(doi='10.1371/journal.pone.0086169'))\n#\u003e 1 full-text articles retrieved \n#\u003e Min. Length: 110717 - Max. Length: 110717 \n#\u003e DOIs: 10.1371/journal.pone.0086169 ... \n#\u003e \n#\u003e NOTE: extract xml strings like output['\u003cdoi\u003e']\n```\n\nThen parse the XML any way you like, here getting the abstract\n\n\n```r\nlibrary(\"XML\")\nxpathSApply(xmlParse(out$`10.1371/journal.pone.0086169`), \"//abstract\", xmlValue)\n#\u003e [1] \"Mammalian females pay high energetic costs for reproduction, the greatest of which is imposed by lactation. The synthesis of milk requires, in part, the mobilization of bodily reserves to nourish developing young. Numerous hypotheses have been advanced to predict how mothers will differentially invest in sons and daughters, however few studies have addressed sex-biased milk synthesis. Here we leverage the dairy cow model to investigate such phenomena. Using 2.39 million lactation records from 1.49 million dairy cows, we demonstrate that the sex of the fetus influences the capacity of the mammary gland to synthesize milk during lactation. Cows favor daughters, producing significantly more milk for daughters than for sons across lactation. Using a sub-sample of this dataset (N = 113,750 subjects) we further demonstrate that the effects of fetal sex interact dynamically across parities, whereby the sex of the fetus being gestated can enhance or diminish the production of milk during an established lactation. Moreover the sex of the fetus gestated on the first parity has persistent consequences for milk synthesis on the subsequent parity. Specifically, gestation of a daughter on the first parity increases milk production by ∼445 kg over the first two lactations. Our results identify a dramatic and sustained programming of mammary function by offspring in utero. Nutritional and endocrine conditions in utero are known to have pronounced and long-term effects on progeny, but the ways in which the progeny has sustained physiological effects on the dam have received little attention to date.\"\n```\n\n### Search within a field\n\nThere are a series of convience functions for searching within sections of articles.\n\n* `plosauthor()`\n* `plosabstract()`\n* `plosfigtabcaps()`\n* `plostitle()`\n* `plossubject()`\n\nFor example:\n\n\n```r\nplossubject(q='marine ecology',  fl = c('id','journal'), limit = 10)\n#\u003e $meta\n#\u003e # A tibble: 1 x 2\n#\u003e   numFound start\n#\u003e      \u003cint\u003e \u003cint\u003e\n#\u003e 1     2287     0\n#\u003e \n#\u003e $data\n#\u003e # A tibble: 10 x 2\n#\u003e    id                                                  journal \n#\u003e    \u003cchr\u003e                                               \u003cchr\u003e   \n#\u003e  1 10.1371/journal.pone.0092590                        PLoS ONE\n#\u003e  2 10.1371/journal.pone.0092590/title                  PLoS ONE\n#\u003e  3 10.1371/journal.pone.0092590/abstract               PLoS ONE\n#\u003e  4 10.1371/journal.pone.0092590/references             PLoS ONE\n#\u003e  5 10.1371/journal.pone.0092590/body                   PLoS ONE\n#\u003e  6 10.1371/journal.pone.0092590/introduction           PLoS ONE\n#\u003e  7 10.1371/journal.pone.0092590/results_and_discussion PLoS ONE\n#\u003e  8 10.1371/journal.pone.0092590/materials_and_methods  PLoS ONE\n#\u003e  9 10.1371/journal.pone.0092590/conclusions            PLoS ONE\n#\u003e 10 10.1371/journal.pone.0149852                        PLOS ONE\n```\n\nHowever, you can always just do this in `searchplos()` like `searchplos(q = \"subject:science\")`. See also the `fq` parameter. The above convenience functions are simply wrappers around `searchplos`, so take all the same parameters.\n\n### Search by article views\n\nSearch with term _marine ecology_, by field _subject_, and limit to 5 results\n\n\n```r\nplosviews(search='marine ecology', byfield='subject', limit=5)\n#\u003e                             id counter_total_all\n#\u003e 5 10.1371/journal.pone.0012946              5309\n#\u003e 3 10.1371/journal.pone.0167128              5423\n#\u003e 1 10.1371/journal.pone.0092590             12839\n#\u003e 2 10.1371/journal.pone.0149852             18954\n#\u003e 4 10.1371/journal.pone.0011372             28244\n```\n\n### Visualize\n\nVisualize word use across articles\n\n\n```r\nplosword(list('monkey','Helianthus','sunflower','protein','whale'), vis = 'TRUE')\n#\u003e $table\n#\u003e   No_Articles       Term\n#\u003e 1       14528     monkey\n#\u003e 2         646 Helianthus\n#\u003e 3        1876  sunflower\n#\u003e 4      164537    protein\n#\u003e 5        2142      whale\n#\u003e \n#\u003e $plot\n```\n\n![wordusage](man/figures/unnamed-chunk-21-1.png)\n\n### progress bars\n\n\n```r\nres \u003c- searchplos(q='*:*', limit = 2000, progress = httr::progress())\n#\u003e  |=====================================| 100%\n#\u003e  |=====================================| 100%\n#\u003e  |=====================================| 100%\n#\u003e  |=====================================| 100%\n```\n\n## Meta\n\n* Please [report any issues or bugs](https://github.com/ropensci/rplos/issues).\n* License: MIT\n* Get citation information for `rplos` in R doing `citation(package = 'rplos')`\n* Please note that this package is released with a [Contributor Code of Conduct](https://ropensci.org/code-of-conduct/). By contributing to this project, you agree to abide by its terms.\n\n---\n\nThis package is part of a richer suite called [fulltext](https://github.com/ropensci/fulltext), along with several other packages, that provides the ability to search for and retrieve full text of open access scholarly articles. We recommend using `fulltext` as the primary R interface to `rplos` unless your needs are limited to this single source.\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fropensci-archive%2Frplos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fropensci-archive%2Frplos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fropensci-archive%2Frplos/lists"}