Checks that observed effort 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);observer_effort- observed effort, in thousand hooks (numeric).
If the function output is assigned then the returned object will contain additional data grooming steps:
NA values in
flagare removed;NA values in
year | monthare removed;NA values in
lat | lonorgeometryare removed;NA or zero values in
observer_effortare removed.
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),
observer_effort = rnorm(20, mean = 2, sd = 0.5))
# check structure of x:
check_observed_effort(x)
# check structure of x with additional data grooming:
x_groomed <- check_observed_effort(x)
nrow(x); nrow(x_groomed)
#> [1] 20
#> [1] 19