You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/r/arxiv.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,9 +30,10 @@ Please see the following resources for more information on API usage:
30
30
31
31
The following packages libraries need to be installed into your environment to run the code examples in this tutorial. These packages can be installed with `install.packages()`.
32
32
33
-
- <ahref="https://cran.r-project.org/web/packages/aRxiv/index.html"target="_blank">arXiv: Interface to the arXiv API</a>
33
+
- <ahref="https://cran.r-project.org/web/packages/aRxiv/index.html"target="_blank">aRxiv: Interface to the arXiv API</a>
34
34
- <ahref="https://cran.r-project.org/web/packages/ggplot2/index.html"target="_blank">ggplot2: Create Elegant Data Visualisations Using the Grammar of Graphics</a>
35
35
36
+
We load the libraries used in this tutorial below:
Copy file name to clipboardExpand all lines: src/r/sdirect.md
+65-23Lines changed: 65 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,40 +1,72 @@
1
+
---
2
+
title: "ScienceDirect API in R"
3
+
output:
4
+
html_document:
5
+
keep_md: true
6
+
---
7
+
1
8
# ScienceDirect API in R
2
9
3
10
by Michael T. Moen
4
11
5
-
These recipe examples demonstrate how to use Elsevier’s [ScienceDirect API](https://dev.elsevier.com/) to retrieve full-text articles in various formats (XML, text).
12
+
These recipe examples demonstrate how to use Elsevier’s <ahref="https://dev.elsevier.com/"target="_blank">ScienceDirect API</a> to retrieve full-text articles in various formats (XML, text).
6
13
7
14
*This tutorial content is intended to help facilitate academic research. Please check your institution for their Text and Data Mining or related License Agreement with Elsevier.*
8
15
9
-
-**Documentation**
10
-
-[ScienceDirect API](https://dev.elsevier.com/)
11
-
-[ScienceDirect API Documentation](https://dev.elsevier.com/sd_api_spec.html)
12
-
13
-
-**Terms**
14
-
-[ScienceDirect API Terms of Use](https://dev.elsevier.com/api_key_settings.html)
16
+
Please see the following resources for more information on API usage:
15
17
16
-
-**Data Reuse**
17
-
-[Elsevier Text & Data Mining](https://dev.elsevier.com/tecdoc_text_mining.html)
- <ahref="https://dev.elsevier.com/sd_api_spec.html"target="_blank">ScienceDirect API Documentation</a>
21
+
- Terms
22
+
- <ahref="https://dev.elsevier.com/api_key_settings.html"target="_blank">ScienceDirect API Terms of Use</a>
23
+
- Data Reuse
24
+
- <ahref="https://dev.elsevier.com/tecdoc_text_mining.html"target="_blank">Elsevier Text & Data Mining</a>
18
25
19
-
> **Note:** See your institution's rate limit in the [ScienceDirect API Terms of Use](https://dev.elsevier.com/api_key_settings.html).
26
+
_**NOTE:**_ See your institution's rate limit with <ahref="https://dev.elsevier.com/api_key_settings.html"target="_blank">ScienceDirect API Terms of Use</a>.
20
27
28
+
*If you have copyright or other related text and data mining questions, please contact The University of Alabama Libraries or your respective library/institution.*
21
29
22
-
*These recipe examples were tested on February 7, 2025.*
30
+
*These recipe examples were tested on October 27, 2025.*
23
31
24
32
## Setup
25
33
26
34
### Import Libraries
27
35
28
-
```r
36
+
The following packages need to be installed into your environment to run the code examples in this tutorial. These packages can be installed with `install.packages()`.
37
+
38
+
- <ahref="https://cran.r-project.org/web/packages/httr/index.html"target="_blank">httr: Tools for Working with URLs and HTTP</a>
39
+
40
+
We load the libraries used in this tutorial below:
41
+
42
+
43
+
```r
29
44
library(httr)
30
45
```
31
46
32
47
### Import API Key
33
48
34
-
An API key is required to access the ScienceDirect API. Registration is available on the [Elsevier developer portal](https://dev.elsevier.com/). The key is imported from an environment variable below:
49
+
An API key is required for to access the ScienceDirect API. You can sign up for one at <ahref="https://dev.elsevier.com/"target="_blank">Elsevier developer portal</a>.
50
+
51
+
We keep our token in a `.Renviron` file that is stored in the working directory and use `Sys.getenv()` to access it. The `.Renviron` should have an entry like the one below.
35
52
36
-
```r
37
-
myAPIKey<- Sys.getenv("sciencedirect_key")
53
+
```text
54
+
SCIENCE_DIRECT_API_KEY="PUT_YOUR_API_KEY_HERE"
55
+
```
56
+
57
+
Below, we can test to whether the key was successfully imported.
58
+
59
+
60
+
```r
61
+
if (nzchar(Sys.getenv("SCIENCE_DIRECT_API_KEY"))) {
62
+
print("API key successfully loaded.")
63
+
} else {
64
+
warning("API key not found or is empty.")
65
+
}
66
+
```
67
+
68
+
```
69
+
## [1] "API key successfully loaded."
38
70
```
39
71
40
72
### Identifier Note
@@ -43,41 +75,51 @@ We will use DOIs as the article identifiers. See our Crossref and Scopus API tut
Copy file name to clipboardExpand all lines: src/r/wiley-tdm.md
+35-18Lines changed: 35 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: "wiley-tdm"
2
+
title: "Wiley Text and Data Mining (TDM) in R"
3
3
output:
4
4
html_document:
5
5
keep_md: true
@@ -9,26 +9,32 @@ output:
9
9
10
10
by Michael T. Moen
11
11
12
-
This tutorial is designed to support academic research. Please consult your institution’s library or legal office regarding its Text and Data Mining license agreement with Wiley.
12
+
The Wiley Text and Data Mining (TDM) API allows users to retrieve the full-text articles of subscribed Wiley content in PDF form. TDM use is for non-commercial scholarly research, see terms and restrictions in below links.
13
13
14
-
### Documentation
15
-
-[Wiley Text and Data Mining](https://onlinelibrary.wiley.com/library-info/resources/text-and-datamining)
14
+
*This tutorial content is intended to help facilitate academic research. Please check your institution for their Text and Data Mining or related License Agreement with Wiley.*
16
15
17
-
### Terms of Use
18
-
-[Wiley Text and Data Mining Agreement](https://onlinelibrary.wiley.com/library-info/resources/text-and-datamining#accordionHeader-3)
16
+
Please see the following resources for more information on API usage:
19
17
20
-
### Data Reuse
21
-
-[Service Name] Data Reuse *(link to be provided by the service)*
18
+
- Documentation
19
+
- <ahref="https://onlinelibrary.wiley.com/library-info/resources/text-and-datamining"target="_blank">Wiley Text and Data Mining</a>
20
+
- Terms
21
+
- <ahref="https://onlinelibrary.wiley.com/library-info/resources/text-and-datamining#accordionHeader-3"target="_blank">Wiley Text and Data Mining Agreement</a>
22
+
- Data Reuse
23
+
- <ahref="https://onlinelibrary.wiley.com/library-info/resources/text-and-datamining#accordionHeader-3"target="_blank">Wiley TDM Data Reuse</a> (see sections 4 and 5 of Text and Data Mining Agreement)
22
24
23
-
*These recipe examples were tested on February 12, 2025.*
25
+
*These recipe examples were tested on October 27, 2025.*
24
26
25
27
**_NOTE:_** The Wiley TDM API limits requests to a maximum of 3 requests per second.
26
28
27
29
## Setup
28
30
29
31
### Import Libraries
30
32
31
-
This tutorial uses the following libraries:
33
+
The following packages need to be installed into your environment to run the code examples in this tutorial. These packages can be installed with `install.packages()`.
34
+
35
+
- <ahref="https://cran.r-project.org/web/packages/httr/index.html"target="_blank">httr: Tools for Working with URLs and HTTP</a>
36
+
37
+
We load the libraries used in this tutorial below:
32
38
33
39
34
40
```r
@@ -37,14 +43,27 @@ library(httr)
37
43
38
44
### Text and Data Mining Token
39
45
40
-
A token is required to access the Wiley TDM API. Sign up can be found [here](https://onlinelibrary.wiley.com/library-info/resources/text-and-datamining#accordionHeader-2). Import your token below:
46
+
A token is required for text and data mining with Wiley. You can sign up for one on the <ahref="https://onlinelibrary.wiley.com/library-info/resources/text-and-datamining#accordionHeader-2"target="_blank">Wiley Text and Data Mining page</a>.
47
+
48
+
We keep our token in a `.Renviron` file that is stored in the working directory and use `Sys.getenv()` to access it. The `.Renviron` should have an entry like the one below.
49
+
50
+
```text
51
+
WILEY_TDM_TOKEN="PUT_YOUR_TOKEN_HERE"
52
+
```
53
+
54
+
Below, we can test to whether the key was successfully imported.
41
55
42
56
43
57
```r
44
-
wiley_token<- Sys.getenv("wiley_token")
58
+
if (nzchar(Sys.getenv("WILEY_TDM_TOKEN"))) {
59
+
print("API key successfully loaded.")
60
+
} else {
61
+
warning("API key not found or is empty.")
62
+
}
63
+
```
45
64
46
-
# The token will be sent as a header in the API calls
0 commit comments