Apply standard cleaning steps to a datras_raw / DATRASraw object.
Usage
clean_datras(
x,
aphias = NULL,
years = NULL,
quarters = NULL,
gears = NULL,
impute_missing_depth = TRUE,
correct_species = TRUE,
do_fishglob = FALSE
)Arguments
- x
A
datras_rawobject.- aphias
Optional numeric or character vector of Aphia IDs (
Valid_Aphia) to retain.- years
Optional integer vector of years to retain.
- quarters
Optional integer vector of quarters to retain.
- gears
Optional character vector of gear codes to retain.
- impute_missing_depth
Logical. If
TRUE(default), missing haul depths are imputed using a smooth spatial GAM fitted to observed depths.- correct_species
Logical. If
TRUE(default), species information is corrected usingcorrect_species().- do_fishglob
Logical. If
TRUE, applyclean_fishglob()instead of the standard DATRAS cleaning steps.
Details
For standard DATRAS data, the function removes invalid hauls, keeps only records with complete standard-species recording, optionally imputes missing haul depths, optionally corrects species information, and can subset the data by species, year, quarter, or gear.
If do_fishglob = TRUE, cleaning is delegated to clean_fishglob().
For standard DATRAS data (do_fishglob = FALSE), the following filters are
applied before any optional subsetting:
only hauls with
HaulVal %in% c("V", "N")are retained,only records with
StdSpecRecCode == 1are retained.
If impute_missing_depth = TRUE, missing Depth values are predicted from a
GAM of log(Depth) on a two-dimensional smooth of longitude and latitude.
Optional filtering by aphias, years, quarters, and gears is applied
after cleaning.
