Description Usage Arguments Details Note Author(s) Examples
Put a call to this function where you would put a file-path - everything is cached by default, so you don't have to worry about multiple downloads in the same session.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | suppdata(x, si, from = c("auto", "plos", "wiley", "science",
"proceedings", "figshare", "esa_data_archives", "esa_archives",
"biorxiv", "epmc", "peerj", "copernicus"), save.name = NA, dir = NA,
cache = TRUE, vol = NA, issue = NA, list = FALSE, timeout = 10)
## S3 method for class 'character'
suppdata(x, si, from = c("auto", "plos", "wiley",
"science", "proceedings", "figshare", "esa_data_archives",
"esa_archives", "biorxiv", "epmc", "peerj", "copernicus"),
save.name = NA, dir = NA, cache = TRUE, vol = NA, issue = NA,
list = FALSE, timeout = 10)
## S3 method for class 'ft_data'
suppdata(x, si, from = c("auto"), save.name = NA,
dir = NA, cache = TRUE, vol = NA, issue = NA, list = FALSE,
timeout = 10)
## S3 method for class 'ft'
suppdata(x, si, from = c("auto"), save.name = NA,
dir = NA, cache = TRUE, vol = NA, issue = NA, list = FALSE,
timeout = 10)
|
x |
One of: vector of DOI(s) of article(s) (a
|
si |
number of the supplementary information (SI) to be downloaded (1, 2, 3,
etc.), or (for ESA, Science, and Copernicus journals) the name of the
supplement (e.g., "S1_data.csv"). Can be a |
from |
Publisher of article ( |
save.name |
a name for the file to download
( |
dir |
directory to save file to ( |
cache |
if |
vol |
Article volume (Proceedings journals only;
|
issue |
Article issue (Proceedings journals only;
|
list |
if |
timeout |
how long to wait for successful download (default 10 seconds) |
The examples probably give the best indication of how to
use this function. In general, just specify the DOI of the article
you want to download data from, and the number of the supplement
you want to download (1, 5, etc.). ESA journals don't use DOIs
(give the article code; see below), and Proceedings, Science, and
ESA journals need you to give the filename of the supplement to
download. For Figshare articles, you can give either the number or
the name. The file extensions (suffixes) of files are returned as
suffix
attributes (see first example), which may be useful
if you don't know the format of the file you're downloading.
For any DOIs not recognised (and if asked) the European PubMed
Central API is used to look up articles. What this database calls a
supplementary file varies by publisher; often they will simply be
figures within articles, but we (obviously) have no way to check
this at run-time. I strongly recommend you run any EPMC calls with
list=TRUE
the first time, to see the filenames that EPMC
gives supplements, as these also often vary from what the authors
gave them. This may actually be a 'feature', not a 'bug', if you're
trying to automate some sort of meta-analysis.
Below is a list of all the publishers this supports, and examples of articles from them.
Default. Use a cross-ref search
(cr_works
) on the DOI to
determine the publisher.
Public Library of Science journals (e.g., PLoS One; https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0126524)
Wiley journals (e.g., https://onlinelibrary.wiley.com/doi/10.1111/ele.12289/abstract)
Science magazine (e.g., https://www.sciencemag.org/content/345/6200/1041.short)
Royal Society of London journals (e.g.,
https://rspb.royalsocietypublishing.org/content/282/1814/20151215). Requires
vol
and issue
of the article.
Figshare (e.g., https://doi.org/10.6084/m9.figshare.979288.v1)
You must give article codes,
not DOIs, for these, which you can find on the article itself. An
ESA Data Archive paper - not to be confused with an ESA Archive,
which is the supplement to an ESA paper. The distinction seems less
crazy once you're reading the paper - if it only describes a
dataset, it's an esa_archive
paper, else it's an
esa_data_archive
. For example,
http://www.esapubs.org/archive/ecol/E092/201/default.htm is
an esa_data_archive
whose article code is E092-201-D1;
http://esapubs.org/Archive/ecol/E093/059/default.htm is a
esa_archive
whose code is E093-059-D1.
Load from bioRxiv (e.g., https://biorxiv.org/content/early/2015/09/11/026575)
Look up an article on the Europe PubMed Central, and then download the file using their supplementary materials API (https://europepmc.org/restfulwebservice). See comments above in 'notes' about EPMC.
PeerJ journals (e.g., https://doi.org/10.7717/peerj.3006) and PeerJ Preprints (e.g., https://doi.org/10.7287/peerj.preprints.26561v1)
Copernicus Publications journals (e.g.,
https://doi.org/10.5194/bg-14-1739-2017), see
https://publications.copernicus.org/open-access_journals/open_access_journals_a_z.html
for a full list of journals. Only one supplemental is supported,
which can be a zip archive or a PDF file.
A numeric si
parameter must be 1
to download the
whole archive, which is saved using Copernicus naming scheme
(<journalname>-<volume>-<firstpage>-<year>-supplement.zip)
and save.name
is ignored, or to download the PDF.
If si
matches the name of the supllemental archive (i.e. uses the
Copernics naming scheme), then the suppdata archive is not unzipped.
si
may be the name of a file in that
archive, so only that file is extracted and saved to save.name
.
Make sure that the article from which you're attempting to download supplementary materials *has* supplementary materials. 404 errors and 'file not found' errors can result from such cases.
Will Pearse (will.pearse@usu.edu) and Scott Chamberlain (myrmecocystus@gmail.com)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #Put the function wherever you would put a file path
crabs <- read.csv(suppdata("10.6084/m9.figshare.979288", 2))
#View the suffix (file extension) of downloaded files
# - note that not all files are uploaded/stored with useful file extensions!
suppdata("10.6084/m9.figshare.979288", 2)
attr(suppdata("10.6084/m9.figshare.979288", 2), "suffix")
#ESA data papers and regular articles *must* be marked
fungi <- read.csv(suppdata("E093-059", "myco_db.csv",
"esa_archives"))
mammals <- read.csv(suppdata("E092-201", "MCDB_communities.csv",
"esa_data_archives"))
epmc.fig <- suppdata("10.1371/journal.pone.0126524",
"pone.0126524.g005.jpg", "epmc")
#...note this 'SI' is not actually an SI, but rather an image from the paper.
copernicus.csv <- suppdata("10.5194/bg-14-1739-2017",
"Table S1 v2 UFK FOR_PUBLICATION.csv",
save.name = "data.csv")
#...note this 'SI' is not an SI but the name of a file in the supplementary information archive.
# (examples not run on CRAN to avoid downloading files repeatedly)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.