-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathREADME.Rmd
164 lines (116 loc) · 5.96 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
---
output: github_document
bibliography: "vignettes/packages.bib"
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
# The oceanexplorer <a href="https://github.com/MartinSchobben/oceanexplorer"><img src="man/figures/logo.png" align="right" height="138" /></a>
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
```{r pkgs, echo=FALSE, message=FALSE, eval=FALSE}
# following code for loading and writing the bibtex references for the used pkgs
pkgs <- c(
# data transformation and visualization
"dplyr", "ggplot2", "purrr",
# package development
"devtools", "shinytest", "vdiffr", "roxygen2", "testthat",
# documentation
"knitr", "rmarkdown",
# spatial analysis
"stars", "sf", "ncmeta",
# shiny app
"thematic", "bslib", "shiny", "waiter", "shinyjs"
)
# Get the R reference
rref <- citation()
# Create ref key
rref$key <- "rversion"
hadley1 <- bibentry(
key = "Wickham2015",
bibtype = "Book",
title = "R packages: organize, test, document, and share your code",
author = person("Hadley","Wickham"),
year = "2015",
publisher = " O'Reilly Media, Inc.",
url = "https://r-pkgs.org/"
)
hadley2 <- bibentry(
key = "Wickham2020",
bibtype = "Book",
title = "Mastering Shiny: Build Interactive Apps, Reports & Dashboards.",
author = person("Hadley","Wickham"),
year = "2020",
publisher = " O'Reilly Media, Inc.",
url = "https://mastering-shiny.org/"
)
knitr::write_bib(pkgs, "vignettes/packages.bib", prefix = "")
pkgs <- bibtex::read.bib("vignettes/packages.bib")
bibtex::write.bib(
purrr::reduce(list(rref, hadley1, hadley2, pkgs), append),
file = "vignettes/packages.bib"
)
```
<!-- badges: start -->
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://choosealicense.com/licenses/mit/)
[![Codecov test coverage](https://codecov.io/gh/MartinSchobben/Oceanexplorer/branch/main/graph/badge.svg)](https://app.codecov.io/gh/MartinSchobben/Oceanexplorer?branch=main)
[![R-CMD-check](https://github.com/MartinSchobben/oceanexplorer/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/MartinSchobben/oceanexplorer/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->
The goal of oceanexplorer is to enable easy access and exploration of the [World Ocean Atlas](https://www.nodc.noaa.gov/OC5/SELECT/woaselect/woaselect.html) of the US agency [NOAA](https://www.ncei.noaa.gov/).
![Demo of the ocean explorer app](man/figures/oceanexplorer-demo.gif){width=95%}
## Check the app
Check the app here: https://martinschobben.shinyapps.io/oceanexplorer/
## Funding <a href="https://www.uu.nl/en/news/erc-grant-for-peter-bijl-to-predict-future-sea-level"><img src="man/figures/oceanice-logo.png" style="float:right; height:50px;"/></a>
This project was funded by ERC Starting grant number 802835, OceaNice, awarded to Peter Bijl.
## Credits
The construction of the R [@rversion] package *oceanexplorer* and associated documentation was aided by the packages; *devtools* [@devtools], *roxygen2* [@roxygen2], *testthat* [@testthat], *shinytest* [@shinytest], *vdiffr* [@vdiffr], *knitr* [@knitr2014 ; @knitr2015], *rmarkdown* [@rmarkdown2018; @rmarkdown2020], and the superb guidance in the book: *R packages: organize, test, document, and share your code*, by @Wickham2015.
Data transformation, cleaning and visualization is performed with: *dplyr* [@dplyr], and *ggplot2* [@ggplot2].
In addition, this package relies on a set of packages for spatial data analysis: *sf* [@sf] and *stars* [@stars].
The app is build with *shiny* [@shiny] and the guidance in the book: *Mastering Shiny: Build Interactive Apps, Reports & Dashboards* [@Wickham2020] was a great help in learning how to develop such applications. Furthermore, the packages *shinyjs* [@shinyjs], *waiter* [@waiter], *bslib* [@bslib] and *thematic* [@thematic] ensure user-friendliness of the interface and visually pleasing graphics.
## Installation
You can install the latest version of oceanexplorer from CRAN
``` r
# Install oceanexplorer from CRAN:
install.packages("oceanexplorer")
```
## Example
The package allows extraction of global databases of several physical and chemical parameters of the ocean from the NOAA World Ocean Atlas.
```{r load}
library(oceanexplorer)
# obtain the NOAA world ocean atlas for oxygen content
oxy_global <- get_NOAA("oxygen", 1, "annual")
```
Slice a specific interval from the array with `filter_NOAA()`, like so:
```{r slice, eval=exists("oxy_global")}
# filter a depth of 200 meters to show OMZs
(oxy_omz <- filter_NOAA(oxy_global, depth = 200))
```
In addition, the sliced array can be plotted, like so:
```{r plot1, eval=exists("oxy_omz")}
# plot the NOAA world ocean atlas for oxygen content
plot_NOAA(oxy_omz, depth = NULL)
```
The same plot can be produced by taking the original data and supplying a value to the `depth` argument and specifying the range of oxygen content to `oxy_omz`.
```{r plot2, eval=exists("oxy_global")}
# plot the NOAA world ocean atlas for oxygen content
plot_NOAA(oxy_global, depth = 200, rng = range(oxy_omz[[1]]))
```
# Interactive exploration
Lastly, the package can launch a Shiny app for interactive exploration of the datasets.
```{r app, eval = FALSE}
# launch an interactive shiny session
NOAA_app()
```
The RStudio addin can be launched within the RStudio viewer pain by executing the following code, or by using the `Addins` drop down menu in the task-bar.
```{r addin, eval = FALSE}
# launch an interactive shiny session
NOAA_addin()
```
## Code of Conduct
Please note that the oceanexplorer project is released with a [Contributor Code of Conduct](https://martinschobben.github.io/oceanexplorer/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.
# References