-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
62 lines (45 loc) · 2.3 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
---
title: "cprdata"
output: github_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
This R package facilitates access and analysis of [NFSC](https://www.fisheries.noaa.gov/about/northeast-fisheries-science-center) [Continuous Plankton Recorder](https://en.wikipedia.org/wiki/Continuous_Plankton_Recorder) (CPR) data. Data can imported from distributed [Excel](https://en.wikipedia.org/wiki/Microsoft_Excel) spreadsheets into data frames, [tibbles](https://tibble.tidyverse.org/) or [sf tables](https://r-spatial.github.io/sf/).
>Part of this dataset was obtained from [NOAA's NFSC](https://www.fisheries.noaa.gov/about/northeast-fisheries-science-center) on 20 January 2024 and might not represent the most up to date data. Please contact NOAA directly for the most recent data. The balance of this dataset is avaiable from the [NERACOOS ERDDAP server](https://www.neracoos.org/erddap/index.html).
## Requirements
+ [R v4.1+](https://www.r-project.org/)
+ [rlang](https://CRAN.R-project.org/package=rlang)
+ [dplyr](https://CRAN.R-project.org/package=dplyr)
+ [readxl](https://CRAN.R-project.org/package=readxl)
+ [stringr](https://CRAN.R-project.org/package=stringr)
+ [readr](https://CRAN.R-project.org/package=readr)
## Installation
```
remotes::install_github("BigelowLab/cprdata")
```
## Usage
### Read the data
The data set contains both zooplankton and phytoplankton data from the Mid-Atlantic Bight and Gulf of Maine regions. We regularly access to the zooplankton data, but it is easy to switch to phytoplankton. We can read the data in its "raw" state as a simple table or transformed into a [sf](https://r-spatial.github.io/sf/) POINT table.
#### Read as a wide table
```{r read_phyto}
library(cprdata)
x = read_cpr(name = "phytoplankton", form = "table") |>
dplyr::glimpse()
```
#### Read as a sf POINT table
Note that we switch to reading zooplankton data and add a `stage` variable.
```{r read_zoop}
x = read_cpr(name = "zooplankton", form = "sf") |>
dplyr::glimpse()
```
#### Plot points
```{r plot_zoop, message=FALSE, warning=FALSE}
suppressPackageStartupMessages({
library(sf)
library(rnaturalearth)
})
coast = ne_coastline(scale = "medium", returnclass = "sf")
plot(st_geometry(coast), extent = x, axes = TRUE)
plot(st_geometry(x), pch = ".", col = "orange", add = TRUE)
```