-
Notifications
You must be signed in to change notification settings - Fork 3
/
README.Rmd
94 lines (61 loc) · 4.03 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
---
title: "azmpdata R package"
author: "Benoit Casault, Emily Chisholm"
date: "`r format(Sys.time(), '%d %B, %Y')`"
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include=F}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
# *azmpdata*
<!-- badges: start -->
[![Travis build status](https://travis-ci.org/casaultb/azmpdata.svg?branch=master)](https://travis-ci.org/casaultb/azmpdata)
<!-- badges: end -->
The R package *azmpdata* provides a series of data products derived from raw data collected as part of the Atlantic Zone Monitoring Program ([AZMP](https://www.dfo-mpo.gc.ca/science/data-donnees/azmp-pmza/index-eng.html)). The data products provided in this package are used to generate the different figures contained in the Research Documents produced annually by Fisheries and Ocean Canada's Maritimes region. The Research Documents describe the physical, chemical and biological conditions observed in Maritimes region since the inception of the AZMP program (see example documents for the [physical](http://www.dfo-mpo.gc.ca/csas-sccs/Publications/ResDocs-DocRech/2018/2018_016-eng.html) conditions and for the [optical, chemical and biological](http://www.dfo-mpo.gc.ca/csas-sccs/Publications/ResDocs-DocRech/2018/2018_017-eng.html) conditions).
## Package Installation
The *azmpdata* R package can be installed from [GitHub](https://github.com) with:
``` r
# install.packages("devtools")
devtools::install_github("casaultb/azmpdata")
```
## Datasets
The *azmpdata* package provides three types of data products: physical, chemical and biological variables, which are summarized below. Each data product is organized into a data table by temporal and regional scale and category.
To access a dataset in data frame format:
```{r dataframe, echo=T, eval=T}
library(azmpdata)
data("Derived_Annual_Broadscale")
head(Derived_Annual_Broadscale)
```
To access a dataset in csv format:
```{r csv, echo=T, eval=T}
system.file("extdata/csv", "Derived_Annual_Broadscale.csv", package = "azmpdata")
```
### Variable Organization
Each table contains multiple variables, which fall under the temporal and regional scale in a particular category. The example shown above includes derived variables at an annual scale for broad regions (eg. Scotian Shelf or Gulf of Maine). Variables can be found via the search function `variable_lookup()`, which allows a user to search by variable name or keyword. For more information see `?variable_lookup`. This function searches through variable names and (optionally) help files from each dataset including metadata and variable definitions.
## Package Functionality
Although the main goal of *azmpdata* is to provide easy access to a variety of data products, the package also supports a few basic functions for which examples are shown below.
#### Searching Data
A custom search function has been developed in order to allow users to find specific data. The function `variable_lookup()` can be used to search through variable names in all `azmpdata` dataframes. Using the argument `search_help`, this function can also search through all the help text for package data. A sample use of this search function may look as below:
```{r}
res <- variable_lookup(keywords = c('nitrate', 'phosphate'), search_help = TRUE)
head(res)
```
#### Dataset Documentation
A detailed description of the whole package is available using the following command:
```{r help_package, echo=T, eval=F}
library(azmpdata)
help("azmpdata")
```
In addition, each dataset is documented and the following command returns a detailed description about a given dataset:
```{r help_dataset, echo=T, eval=F}
library(azmpdata)
help("Derived_Annual_Broadscale")
```
#### Plotting
Plotting `azmpdata` is covered in a detailed vignette `plotting_azmpdata`.
## For developers
Data managers and developers may need to update data within the package. For more details on this process, please see the vignette `update_azmpdata`. The vignette `style_guide` also provides more details on the formatting of new data.