-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME.Rmd
143 lines (93 loc) · 5.17 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
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
---
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%"
)
```
# lwdataexplorer
<!-- badges: start -->
<!-- badges: end -->
Access to [LifeWatch Belgium](lifewatch.be/) data hosted by the [Flanders Marine Institute (VLIZ)](https://www.vliz.be/) in [R](https://www.r-project.org/).
See the package website: https://lifewatch.github.io/lwdataexplorer/
## Installation
You can install the development version of deleteme from [GitHub](https://github.com/lifewatch/lwdataexplorer) using [devtools](https://github.com/r-lib/devtools):
```{r installation, eval = FALSE}
# install.packages("devtools")
devtools::install_github("lifewatch/lwdataexplorer", build_vignettes = TRUE)
```
## Usage
The package `lwdataexplorer` retrieves biodiversity, environmental or genetic data from the projects supported by LifeWatch Belgium. These data is also available to explore and download through the LifeWatch Data Explorer: an R Shiny application that allows you to check and download data from your browser.
You can find more information about these projects and the LifeWatch Data Explorer in this link:
- https://www.lifewatch.be/en/lifewatch-data-explorer
There is a function for each specific data type. For instance, to retrieve data from the moonitoring buoy on the Belgian Part of the North Sea:
```{r etn1, warning = FALSE}
library(lwdataexplorer)
library(tibble) # only for visualizing
df <- getBuoyData("2021-03-19", "2021-04-21", "All")
as_tibble(df)
```
Note that the functions naming includes always the `get` word, followed by the data type.
```{r functions}
# Functions available in the package
ls("package:lwdataexplorer")
```
### Query parameters
To find more information about the query parameters you can check the help page of each function which include some basic examples. For example, to see the help page of the function that retrieves data from the European Tracking Network (ETN):
```{r help, eval = FALSE}
# Open the help page and go over the examples
?getEtnData()
```
### Data under moratorium
Some data types are temporarily under embargo due to the project requirements. To help you to know if the query you are applying was restricted, the query parameters are always printed in the console. If the query parameters you requested were **restricted on the server side**, a warning will be raised and both your query parameters and those applied in the server will be printed in the console.
The example below tries to request some data from the Meetnet Vlaams Banken (MVB). However, without an account some restrictions are applied: (1) parameter is 'Tide TAW', (2) Time grouping is day or hour and (3) dates are only between the last 30 days.
```{r moratorium, warning = TRUE}
# This will raise a warning
mvb <- getMvbData("2020-01-01", "2020-12-31", parameters = 'All',
stations = "All", by = "10min", calc = "none",
params = TRUE)
```
### Get data and query parameters in a list
You can request to get the parameters applied in the server by setting the argument `params = TRUE`. The get functions will return a list with both the data and another list with the query parameters applied in the server
```{r params}
# Request data but with parameters this time
data_with_params <- getBuoyData("2021-03-19", "2021-04-21", "All", params = TRUE)
# Check object type
class(data_with_params)
# What are the elements of the list?
names(data_with_params)
# Get query parameters as a list
data_with_params$par
```
### Wrapper functions
Besides the functions that start with `get`, you can use the `lwdata` function. This is a wrapper for all the other `get` functions. You have to provide the data type as an argument and all the other query parameters for the specific data type. Find more info with `?lwdata()`
For instance, You can request the list of ETN projects with its specific function `listETNprojects()` or using `lwdata()`:
```{r wrapper}
etn <- lwdata('listETNprojects')
as_tibble(etn)
```
### Boost performance
If you are working in one of the LifeWatch Belgium RStudio server, for example https://rstudio.lifewatch.be/ or https://rstudio.vsc.lifewatch.be, you can make your queries run faster. For more information please contact the package maintainer to discuss permissions and configuration.
## More information
### Issues
If you find any problems please [raise a new issue](https://github.com/lifewatch/lwdataexplorer/issues) or contact the package maintainer:
```{r maintainer, eval = FALSE}
# Run once the package is installed
maintainer("lwdataexplorer")
```
### Citation
Please cite this software as:
```{r citation, warning = FALSE, results = 'asis', echo = FALSE}
cat(paste0("> ", citation("lwdataexplorer")$textVersion))
```
You must also cite the datasets retrieved by the lwdataexplorer. You can find more information and their individual citations in the vignettes. The vignettes are available online at: https://lifewatch.github.io/lwdataexplorer/articles/
### License
See the license file.
```{r license, warning = FALSE}
packageDescription("lwdataexplorer", fields="License")
```