Skip to content

R language tools for working Continuous Plankton Recorder (CPR) data

License

Notifications You must be signed in to change notification settings

BigelowLab/cprdata

Repository files navigation

cprdata

This R package facilitates access and analysis of NFSC Continuous Plankton Recorder (CPR) data. Data can imported from distributed Excel spreadsheets into data frames, tibbles or sf tables.

Part of this dataset was obtained from NOAA’s NFSC 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.

Requirements

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 POINT table.

Read as a wide table

library(cprdata)
x = read_cpr(name = "phytoplankton", form = "table") |>
  dplyr::glimpse()
## Rows: 1,649,128
## Columns: 9
## $ source    <chr> "nfsc", "nfsc", "nfsc", "nfsc", "nfsc", "nfsc", "nfsc", "nfs…
## $ cruise    <chr> "EG7107", "EG7107", "EG7107", "EG7107", "EG7107", "EG7107", …
## $ station   <dbl> 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, …
## $ time      <dttm> 1971-11-15 17:00:00, 1971-11-15 17:00:00, 1971-11-15 17:00:…
## $ lon       <dbl> -71.7666, -71.7666, -71.7666, -71.7666, -71.7666, -71.7666, …
## $ lat       <dbl> 39.6, 39.6, 39.6, 39.6, 39.6, 39.6, 39.6, 39.6, 39.6, 39.6, …
## $ pci       <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, …
## $ abundance <dbl> 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, …
## $ name      <chr> "Paralia sulcata [9000]", "Skeletonima costatum [9001]", "Th…

Read as a sf POINT table

Note that we switch to reading zooplankton data and add a stage variable.

x = read_cpr(name = "zooplankton",  form = "sf") |>
  dplyr::glimpse() 
## Rows: 5,697,206
## Columns: 9
## $ source    <chr> "nfsc", "nfsc", "nfsc", "nfsc", "nfsc", "nfsc", "nfsc", "nfs…
## $ cruise    <chr> "EG7107", "EG7107", "EG7107", "EG7107", "EG7107", "EG7107", …
## $ station   <dbl> 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, …
## $ time      <dttm> 1971-11-15 17:00:00, 1971-11-15 17:00:00, 1971-11-15 17:00:…
## $ pci       <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, …
## $ abundance <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ name      <chr> "Unidentified plankton and fragments", "Copepoda", "Copepoda…
## $ stage     <chr> "unstaged", "nauplius", "copepodite v", "parva (postlarva)",…
## $ geometry  <POINT [°]> POINT (-71.7666 39.6), POINT (-71.7666 39.6), POINT (-…

Plot points

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)

About

R language tools for working Continuous Plankton Recorder (CPR) data

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages