Filter plankton data by parameter and location
pr_filter_data(df, Parameter = "Biomass_mgm3", StationRegion = "NSI")A dataframe from pr_get_Indices(), pr_get_EOVs(), or similar
functions
Character string or vector of parameter names to retain. Common parameters include:
Biomass: "Biomass_mgm3", "BiomassIndex_mgm3", "PhytoBiomassCarbon_pgL"
Abundance: "Abundance_m3", "AbundanceIndex_Samplekm", "TotalCopepodAbundance_m3"
Diversity: "ShannonDiversity", "TotalTaxa_Sample", "Richness"
Character string or vector of locations to retain:
For NRS data: Station codes like "NSI", "PHB", "MAI", "ROT",
"YON", "DAR", "KAI", "ESP", "NIN"
For CPR data: Bioregions like "Temperate East", "South-east",
"South-west", "North-west", "Coral Sea"
A filtered dataframe maintaining the same structure as input
Convenience function to filter index data to specific parameters and locations before plotting or analysis. Automatically detects whether data uses station codes (NRS) or bioregions (CPR) and filters accordingly.
This function streamlines the common workflow of filtering data before creating plots or running analyses. It:
Detects data type automatically (NRS vs CPR)
Filters on Parameters column to match Parameter argument
Filters on StationCode (NRS) or BioRegion (CPR) to match StationRegion argument
Validates inputs to catch common errors
Use this function when:
Creating plots for specific stations or regions
Comparing multiple parameters at the same location(s)
Preparing data for statistical analysis on a subset of locations
Both Parameter and StationRegion accept vectors, enabling:
Multiple parameters at one station: Parameter = c("Biomass_mgm3", "Abundance_m3"), StationRegion = "NSI"
One parameter at multiple stations: Parameter = "Biomass_mgm3", StationRegion = c("NSI", "PHB", "MAI")
Multiple parameters at multiple stations: vectors for both arguments
pr_get_Indices() for loading data before filtering
pr_plot_TimeSeries(), pr_plot_Trends(), pr_plot_Climatology() for plotting filtered data
# Filter CPR data to biomass in two bioregions
df <- pr_get_Indices("CPR", "Zooplankton") %>%
pr_filter_data("BiomassIndex_mgm3", c("North", "South-west"))
# Filter NRS data to phytoplankton carbon at two stations
df <- pr_get_Indices("NRS", "Phytoplankton") %>%
pr_filter_data("PhytoBiomassCarbon_pgL", c("NSI", "PHB"))
# Multiple parameters at one station
df <- pr_get_Indices("NRS", "Zooplankton") %>%
pr_filter_data(c("Biomass_mgm3", "Abundance_m3", "ShannonDiversity"), "MAI")