forked from ropensci/rcrossref
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrcrossref.Rmd.og
181 lines (127 loc) · 3.51 KB
/
rcrossref.Rmd.og
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
---
title: rcrossref introduction
author: Scott Chamberlain
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{rcrossref introduction}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r echo=FALSE}
knitr::opts_chunk$set(
comment = "#>",
collapse = TRUE,
warning = FALSE,
message = FALSE
)
```
## Installation
Install stable version from CRAN
```{r eval=FALSE}
install.packages("rcrossref")
```
Or development version from GitHub
```{r eval=FALSE}
remotes::install_github("ropensci/rcrossref")
```
```{r}
library("rcrossref")
```
## Citation search
CrossRef's DOI Content Negotiation service, where you can citations back in various formats, including `apa`
```{r}
cr_cn(dois = "10.1371/journal.pone.0112608", format = "text", style = "apa")
```
There are a lot more styles. We include a dataset as a character vector within the package, accessible via the `get_styles()` function, e.g.,
```{r}
get_styles()[1:5]
```
`bibtex`
```{r}
cat(cr_cn(dois = "10.1126/science.169.3946.635", format = "bibtex"))
```
`bibentry`
```{r}
cr_cn(dois = "10.6084/m9.figshare.97218", format = "bibentry")
```
## Citation count
Citation count, using OpenURL
```{r}
cr_citation_count(doi="10.1371/journal.pone.0042793")
```
## Search Crossref metadata API
The following functions all use the CrossRef API.
### Look up funder information
```{r}
cr_funders(query="NSF")
```
### Check the DOI minting agency
```{r}
cr_agency(dois = '10.13039/100000001')
```
### Search works (i.e., articles, books, etc.)
```{r}
cr_works(filter=c(has_orcid=TRUE, from_pub_date='2004-04-04'), limit=1)
```
### Search journals
```{r}
cr_journals(issn=c('1803-2427','2326-4225'))
```
### Search license information
```{r}
cr_licenses(query = 'elsevier')
```
### Search based on DOI prefixes
```{r}
cr_prefixes(prefixes=c('10.1016','10.1371','10.1023','10.4176','10.1093'))
```
### Search CrossRef members
```{r}
cr_members(query='ecology', limit = 5)
```
### Get N random DOIs
`cr_r()` uses the function `cr_works()` internally.
```{r}
cr_r()
```
You can pass in the number of DOIs you want back (default is 10)
```{r}
cr_r(2)
```
## Get full text
Publishers can optionally provide links in the metadata they provide to Crossref for full text of the work, but that data is often missing. Find out more about it at https://support.crossref.org/hc/en-us/articles/215750183-Crossref-Text-and-Data-Mining-Services
Get some DOIs for articles that provide full text, and that have `CC-BY 3.0` licenses (i.e., more likely to actually be open)
```{r}
out <-
cr_works(filter = list(has_full_text = TRUE,
license_url = "http://creativecommons.org/licenses/by/3.0/"))
(dois <- out$data$doi)
```
From the output of `cr_works` we can get full text links if we know where to look:
```{r}
do.call("rbind", out$data$link)
```
From there, you can grab your full text, but because most links require
authentication, enter another package: `crminer`.
You'll need package `crminer` for the rest of the work.
Onc we have DOIs, get URLs to full text content
```{r eval=FALSE}
if (!requireNamespace("crminer")) {
install.packages("crminer")
}
```
```{r}
library(crminer)
(links <- crm_links("10.1155/2014/128505"))
```
Then use those URLs to get full text
```{r eval=FALSE}
crm_pdf(links)
#> <document>/Users/sckott/Library/Caches/R/crminer/128505.pdf
#> Pages: 1
#> No. characters: 1565
#> Created: 2014-09-15
```
See also fulltext (https://github.com/ropensci/fulltext) for getting scholarly text
for text mining.