-
Notifications
You must be signed in to change notification settings - Fork 0
/
example_ropensci_packacges.Rmd
63 lines (51 loc) · 1.77 KB
/
example_ropensci_packacges.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
---
title: "Example rOpenSci Packages"
author: "Martin Fenner"
date: "5. Oktober 2015"
output:
html_document:
keep_md: true
---
[rOpenSci](https://ropensci.org) provides R packages for scholarly APIs, including altmetrics services.
### alm
A package for the [lagotto](https://github.com/lagotto/lagotto) open source application. The [alm tutorial](https://ropensci.org/tutorials/alm_tutorial.html) is a good starting point.
Install and load the package with
```{r}
#install.packages("alm")
library(alm)
```
My default the package talks to the lagotto instance run by the publisher PLOS at `http://alm.plos.org`. You can specify the `url` parameter to talk to a different instance of the Lagotto API, e.g. `http://cls.labs.datacite.org`.
Get metrics for a particular DOI
```{r}
out <- alm_ids(doi="10.1371/journal.pone.0029797")
out$data
```
get metrics for a set of DOIs
```{r}
dois <- c('10.1371/journal.pone.0001543','10.1371/journal.pone.0040117',
'10.1371/journal.pone.0029797','10.1371/journal.pone.0039395')
out <- alm_ids(doi=dois)
lapply(out$data, head)
```
### rcrossref
A package for the CrossRef REST API.
```{r}
#install.packages("rcrossref")
library(rcrossref)
```
Using DOI content negotiation to get bibtex-formatted metadata.
```{r}
cat(cr_cn(dois = "10.1126/science.169.3946.635", format = "bibtex"))
```
DOI content negotiation also works with DataCite DOIs.
```{r}
cat(cr_cn(dois = "10.6084/M9.FIGSHARE.758498", format = "bibtex"))
```
Sometimes we need to know whether a DOI is from CrossRef or DataCite (or another registration agency).
```{r}
cr_agency(dois = c("10.1126/science.169.3946.635", "10.6084/M9.FIGSHARE.758498"))
```
We can get 50 random DOIs from 2014 with the following:
```{r}
cr_r(sample = 50, from_pub_date='2014-01-01', until_pub_date='2014-12-31')
```