Checks that observed captures dataset has the (minimum) variables required for data preparation:
flag- an ISO 3166-1 alpha-3 compliant country code, e.g.,"NZL"(character);year- calendar year (integer);month- month (integer);latandlon- latitude and longitude (decimal degrees - numeric), orgeometry- a simple feature collection (classsfc);code- a three-letter 'species' code (character - seesp_groups$codefor a set of bioligical inputsinputsBio);status- status of captures at-vessel ("alive"),"dead"orNAfor unknown);age_class- age-class of captures ("adult"),"immature","juvenile"orNAfor unknown);n_captures- number of individuals (integer or numeric).
If the function output is assigned then the returned object will contain additional data grooming steps:
NA values in
codeare removed;NA or zero values in
n_capturesare removed.
The User should additionally ensure that the observed captures dataset is filtered to include only captures from strata with available observed effort, e.g., if information for required minimum variables was missing for a strata. An example of this process is provided in the make_inputs vignette: vignette("make_inputs", package = "sefraInputs").
Value
If assigned, returns an object of class class(data), with data grooming to exclude missing values in required fields.
Examples
library(sefraInputs)
library(dplyr)
x <- data.frame(
flag = c(NA, rep("NZL", times = 19)), year = sample(2015:2020, size = 20, replace = TRUE),
month = sample(1:12, size = 20, replace = TRUE),
lat = sample(-(35:40), size = 20, replace = TRUE), lon = sample(100:140, size = 20, replace = TRUE),
code = sample(c("DIW", "PRK", "PRO"), size = 20, replace = TRUE),
status = sample(c("alive", "dead", NA), size = 20, replace = TRUE),
age_class = sample(c("adult", "immature", NA), size = 20, replace = TRUE),
n_captures = sample(0:5, size = 20, replace = TRUE))
# check structure of x:
check_observed_captures(x)
# check structure of x with additional data grooming:
x_groomed <- check_observed_captures(x)
nrow(x); nrow(x_groomed)
#> [1] 20
#> [1] 17