forked from RaoulWolf/cccapi
-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.Rmd
95 lines (72 loc) · 3.02 KB
/
README.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
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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r}
#| include = FALSE
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# cccapi <img src="man/figures/logo.svg" align="right" height="139" />
<!-- badges: start -->
[![R-CMD-check](https://github.com/RaoulWolf/cccapi/workflows/R-CMD-check/badge.svg)](https://github.com/RaoulWolf/cccapi/actions)
[![Codecov test coverage](https://codecov.io/gh/RaoulWolf/cccapi/branch/master/graph/badge.svg)](https://app.codecov.io/gh/RaoulWolf/cccapi?branch=master)
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
<!-- badges: end -->
> A [ZeroPM](https://zeropm.eu/) R package
The goal of the cccapi package is to provide a minimal and lightweight
interface to the [CAS Common Chemistry](https://commonchemistry.cas.org/) API
services. To get access to the API services, you need to register at
[https://www.cas.org/services/commonchemistry-api](https://www.cas.org/services/commonchemistry-api).
The dependencies of cccapi are kept at a bare minimum:
[curl](https://cran.r-project.org/web/packages/curl/index.html) for handling
the API requests and
[jsonlite](https://cran.r-project.org/web/packages/jsonlite/index.html) to
parse data from JSON format.
## Installation
You can install the development version of cccapi from
[GitHub](https://github.com/) with:
```{r install}
#| eval = FALSE
# install.packages("remotes")
remotes::install_github("ZeroPM-H2020/cccapi")
```
## Examples
The following examples show the functionality of the three API functions of
cccapi: `get_detail()`, `get_export()`, and `get_search()`.
This is an example which shows you how to get the record details for a CAS
Registry Number. In this case, for
[atrazine](https://en.wikipedia.org/wiki/Atrazine):
```{r example1}
library(cccapi)
atz_det <- get_detail("1912-24-9")
str(atz_det)
```
Here is an example which shows you how to get the MOL file for a CAS Registry
Number. In this case, again, for atrazine:
```{r example2}
atz_exp <- get_export("1912-24-9")
str(atz_exp)
```
And finally, here is an example which shows you how to search for CAS Registry
Numbers with a partial name. See `?get_search` for details on the available
search options!
```{r example3}
atz_src <- get_search("atrazin*")
str(atz_src)
```
## Acknowledgement
This R package was developed by the EnviData initiative at the
[Norwegian Geotechnical Institute (NGI)](https://www.ngi.no/eng) as part of the
project
[ZeroPM: Zero pollution of Persistent, Mobile substances](https://zeropm.eu/).
This project has received funding from the European Union's Horizon 2020
research and innovation programme under grant agreement No 101036756.
---
If you find this package useful and can afford it, please consider making a
donation to a humanitarian non-profit organization, such as
[Sea-Watch](https://sea-watch.org/en/). Thank you.