-
Notifications
You must be signed in to change notification settings - Fork 2
/
README.Rmd
47 lines (35 loc) · 1.39 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
---
title: "aquamonitR"
output: github_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
Query the Nivabase directly from your R code and get results back as R data.frames. {aquamonitR} uses the Aquamonitor API to access the Nivabase securely, regardless of whether you're logged in to the NIVA network/VPN.
This repository is currently just a rough translation of the essential parts of Roar's [Aquamonitor-Python](https://github.com/NIVANorge/Aquamonitor-Python) library. The functionality of both libraries is currently limited, and development here will lag development of Aquamonitor-Python.
## Installation
```{r,eval=FALSE}
# install.packages("devtools")
remotes::install_github("NIVANorge/aquamonitR")
```
## Quick start
```{r,eval=FALSE}
library(aquamonitR)
# Login
token <- login()
# List all projects
proj_df <- get_projects(token = token)
paste0(nrow(proj_df), " projects in the database.")
head(proj_df)
# Get stations in project
proj_id <- 12433
stn_df <- get_project_stations(proj_id, token = token)
paste0(nrow(stn_df), " stations in project.")
head(stn_df)
# Get water chemistry for project and time period
st_dt <- "01.01.2019"
end_dt <- "31.12.2019"
df <- get_project_chemistry(proj_id, st_dt, end_dt, token = token)
head(df)
```
See also the example notebook [here](https://nbviewer.jupyter.org/github/NIVANorge/aquamonitR/blob/main/examples/query_chem.ipynb)