Title: | Fisheries Overviews for ICES Advice |
---|---|
Description: | Functions that work with International Council for the Exploration of the Sea (ICES) web services and databases to collate, aggregate, and plot Fisheries Overview products. |
Authors: | Scott Large [aut, cre] |
Maintainer: | Scott Large <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.2 |
Built: | 2024-10-26 03:25:42 UTC |
Source: | https://github.com/ices-tools-prod/fisheryO |
area_definition
returns list of sf dataframes with shape information of Europe, ICES Areas and ICES Ecoregions.
area_definition(ecoregion = "Greater North Sea Ecoregion")
area_definition(ecoregion = "Greater North Sea Ecoregion")
ecoregion |
character of the ecoregion to plot. e.g., "Greater North Sea Ecoregion" |
list of ices_shape (data frame), eco_shape (data frame), europe_shape (data frame) and centroids (data frame)
European map is from Natural Earth (scale = 10) via the rnaturalearth package
Scott Large
Used in area_definition_map
to a map describing potential mismatches between ICES Ecoregions and ICES Areas.
Input data: ices_shape
, eco_shape
, and europe_shape
.
area_definition_map
returns a map describing potential mismatches between ICES Ecoregions and ICES Areas
area_definition_map(ecoregion, data_caption = TRUE, save_plot = FALSE, return_plot = TRUE, output_path = NULL, file_name = NULL)
area_definition_map(ecoregion, data_caption = TRUE, save_plot = FALSE, return_plot = TRUE, output_path = NULL, file_name = NULL)
ecoregion |
ecoregion name, e.g. Greater North Sea Ecoregion |
data_caption |
print the data source as a caption, boolean. |
A png or ggplot plot
Scott Large
SAG summary table and reference points come from clean_sag
. frmt_summary_table
evaluates
status relative to reference points and formats the table for .html.
## Not run: area_definition_map("Greater North Sea") ## End(Not run)
## Not run: area_definition_map("Greater North Sea") ## End(Not run)
clean_sag
returns a merged and tidied SAG reference points and summary table and a formatted (.html) stock list
clean_sag(active_year = 2016)
clean_sag(active_year = 2016)
active_year |
numeric of the stock database version. e.g., 2016 |
list of stock_list_frmt (data frame) and sag_complete_summary (tbl_df)
Periodically, ICES adds or removes stocks from the advisory process. The function returns the SAG reference points and summary table for all published (in SAG) and active stocks for a given year.
Scott Large
Used in stock_trends_fun
to make clickable information on dynamic
line plots of F and SSB relative to F<sub>MSY</sub> and MSY B<sub>trigger</sub>
reference points for stocks of a fish category for an ecoregion.
Also, used in frmt_summary_table
.
Input data: stock_list_raw
, sag_summary_raw
,sag_refpts_raw
, and sag_keys_raw
.
head(clean_sag(active_year = 2016))
head(clean_sag(active_year = 2016))
clean_stock_trends
returns list of 2: data frame of F and SSB relative to
F<sub>MSY</sub> and MSY B<sub>trigger</sub> reference points for stocks of a fish category for an
ecoregion and sag_complete_summary
from clean_sag
.
clean_stock_trends(active_year = 2016, grouping_var = c("EcoGuild", "EcoRegion", "FisheriesGuild")[1], plotting_var = c("StockCode", "FisheriesGuild")[1], metric = c("MSY", "MEAN")[1])
clean_stock_trends(active_year = 2016, grouping_var = c("EcoGuild", "EcoRegion", "FisheriesGuild")[1], plotting_var = c("StockCode", "FisheriesGuild")[1], metric = c("MSY", "MEAN")[1])
active_year |
numeric of the stock database version (year). e.g., 2016 |
grouping_var |
character string of the desired grouping. Options include: EcoRegion, EcoGuild, or FisheriesGuild |
plotting_var |
character string of the variable to plot. Options include: StockCode or FisheriesGuild (mean) |
metric |
character string of the desired metric. Options include: MSY or MEAN (according to grouping_var) |
A list of 2: 1) data frame of F and SSB relative to F<sub>MSY</sub> and MSY B<sub>trigger</sub> reference points
for stocks of a fish category for an ecoregion and 2) sag_complete_summary
from clean_sag
.
Stocks are linked to ecoregions and fish categories via the ICES Stock database. Reference points are as published in ICES Stock Assessment Graphs database. In some cases, status relative to reference points may vary from published ICES advice when reported F or SSB are very close to reference points (e.g., F = 0.201 > F<sub>MSY</sub> = 0.20).
Scott Large
Used in stock_trends_fun
for line plots of F and SSB relative to F<sub>MSY</sub> and MSY B<sub>trigger</sub>
reference points for stocks of a fish category for an ecoregion.
Input data: From clean_sag
## Not run: clean_stock_trends(2016) ## End(Not run)
## Not run: clean_stock_trends(2016) ## End(Not run)
ICES Ecoregions. Accessed 23 May 2017.
OBJECTIDadd text
Ecoregionadd text
Shape_Lengadd text
Shape_Le_1add text
Shape_Areaadd text
geometryadd text
eco_shape
eco_shape
A sf data frame with 17 rows and 6 variables.
http://gis.ices.dk/shapefiles/ICES_ecoregions.zip
ICES Ecoregions. Accessed 23 May 2017.
iso_a3add text
iso_n3add text
adminadd text
geometryadd text
europe_shape
europe_shape
A sf data frame with 51 rows and 6 variables. From Natural Earth via the rnaturalearth package
http://www.naturalearthdata.com/, https://cran.r-project.org/package=rnaturalearth
The fisheryO package is offered to provide documentation of the processes used to download, aggregate, and analyze data for ICES Fisheries Overviews. Further, the package contains R functions to facilitate the standard plotting of these data.
area_definition_map
stockSummaryTable_fun
stockPie_fun
gesPie_fun
stock_trends_fun
plot_kobe
guild_discards_fun
ices_catch_plot
stecf_plot
area_definition
clean_sag
frmt_summary_tbl
stock_props
ices_stock_props
ges_stock_props
clean_stock_trends
stock_catch
stock_status
ices_catch_data
stecf_data
stock_list_raw
sag_summary_raw
sag_refpts_raw
sag_keys_raw
ices_catch_historical_raw
ices_catch_official_raw
species_list_raw
stecf_effort_raw
stecf_landings_raw
ices_shape
eco_shape
europe_shape
frmt_summary_tbl
returns the stock summary table plain and formatted with html (e.g., glyphicons and italics)
frmt_summary_tbl(active_year = active_year, calculate_status = calculate_status, return_clean_sag = FALSE)
frmt_summary_tbl(active_year = active_year, calculate_status = calculate_status, return_clean_sag = FALSE)
active_year |
numeric of the stock database version. e.g., 2016 |
calculate_status |
logical on whether to use raw SAG output to calculate stock status or to use the hard-coded values from stock summary table |
return_clean_sag |
logical to return objects from clean_sag() |
data frame
Periodically, ICES adds or removes stocks from the advisory process. The function returns the stock summary table for all published (in SAG) and active stocks for a given year.
calculate_status = TRUE
calculates stock status
relative to published reference points. This will represent PA and SBL for ecoregions with proxy reference points. calculate_status = TRUE
takes the
raw icons from published advice. Note, before 2017 not all stocks status tables have been added to the SAG database and only few stocks had MSY proxy reference points.
Scott Large
Used in stockSummaryTable_fun
to create the "Status of stock summary relative to reference points"
table for all stocks for an ecoregion. Input data: SAG summary table and reference points come from clean_sag
.
head(frmt_summary_tbl(active_year = 2016)$summary_table)
head(frmt_summary_tbl(active_year = 2016)$summary_table)
ges_stock_props
returns a data frame of the proportion of stocks
relative to GES reference points for all ecoregion.
ges_stock_props(active_year = active_year, ecoregion = ecoregion, calculate_status = calculate_status, fisheries_guild = fisheries_guild)
ges_stock_props(active_year = active_year, ecoregion = ecoregion, calculate_status = calculate_status, fisheries_guild = fisheries_guild)
active_year |
numeric of the stock database version (year). e.g., 2016 |
ecoregion |
vector of ecoregions to include |
calculate_status |
logical on whether to use raw SAG output to calculate stock status or to use the hard-coded values from stock summary table |
fisheries_guild |
vector of fisheries guilds to include |
returns a data frame of the proportion of stocks relative to ICES reference points for fish categories in ecoregions.
Periodically, ICES adds or removes stocks from the advisory process. The function returns
the SAG reference points and summary table for all published (in SAG) and active stocks for a given year.calculate_status = TRUE
calculates stock status
relative to published reference points. This will represent PA and SBL for ecoregions with proxy reference points. calculate_status = TRUE
takes the
raw icons from published advice. Note, before 2017 not all stocks status tables have been added to the SAG database and only few stocks had MSY proxy reference points.
Scott Large
Used in gesPie_fun
to plot proportion of stocks relative
to GES reference points for all ecoregions.
Input data: From stock_props
, which brings sag_complete_summary
and stock_list_frmt
from clean_sag
.
## Not run: ges_stock_props(2016) ## End(Not run)
## Not run: ges_stock_props(2016) ## End(Not run)
The gesPie_fun
function returns pie charts of the proportion of stocks
relative to GES reference points in an ecoregion.
gesPie_fun(ecoregion, fisheries_guild = c("pelagic", "demersal", "crustacean", "elasmobranch", "benthic"), calculate_status = FALSE, data_caption = TRUE, file_name = NULL, active_year = 2016, save_plot = FALSE, return_plot = TRUE, return_data = FALSE, output_path = NULL)
gesPie_fun(ecoregion, fisheries_guild = c("pelagic", "demersal", "crustacean", "elasmobranch", "benthic"), calculate_status = FALSE, data_caption = TRUE, file_name = NULL, active_year = 2016, save_plot = FALSE, return_plot = TRUE, return_data = FALSE, output_path = NULL)
ecoregion |
ecoregion name, e.g. Greater North Sea |
fisheries_guild |
fisheries guild to include in proportions |
calculate_status |
logical on whether to use raw SAG output to calculate stock status or to use the hard-coded values from stock summary table |
data_caption |
print the data source as a caption, boolean. |
file_name |
name for the output. |
active_year |
numeric of the stock database version (year). e.g., 2016 |
save_plot |
logical to save plot. |
return_plot |
logical to return plot to current environment. |
return_data |
logical on returning a .csv of plotted data |
output_path |
path for output to live. |
A ggplot2 object or .png saved as file_name
to output_path
.
When file_name
is NULL
, the file name is the ecoregion.
When output_path
is NULL
, the file is saved to "~/".
Stocks are linked to ecoregions via the ICES Stock database.
Reference points are as published in ICES Stock Assessment Graphs database. In some cases,
status relative to reference points may vary from published ICES advice
when reported F or SSB are very close to reference points (e.g., F = 0.201 > F<sub>MSY</sub> = 0.20). calculate_status = TRUE
calculates stock status
relative to published reference points. This will represent PA and SBL for ecoregions with proxy reference points. calculate_status = TRUE
takes the
raw icons from published advice. Note, before 2017 not all stocks status tables have been added to the SAG database and only few stocks had MSY proxy reference points.
Scott Large
## Not run: gesPie_fun("Greater North Sea Ecoregion", return_plot = TRUE) ## End(Not run)
## Not run: gesPie_fun("Greater North Sea Ecoregion", return_plot = TRUE) ## End(Not run)
The guild_discards_fun
function returns a series of plots of discard rate and landings by fish category for an ecoregion.
guild_discards_fun(ecoregion, active_year = 2016, data_caption = TRUE, output_path = NULL, save_plot = FALSE, return_plot = TRUE, return_data = FALSE, file_name = NULL)
guild_discards_fun(ecoregion, active_year = 2016, data_caption = TRUE, output_path = NULL, save_plot = FALSE, return_plot = TRUE, return_data = FALSE, file_name = NULL)
ecoregion |
ecoregion name, e.g. Greater North Sea Ecoregion |
active_year |
numeric of the stock database version (year). e.g., 2016 |
data_caption |
print the data source as a caption, boolean. |
output_path |
path for output to live. |
save_plot |
logical to save plot. |
return_plot |
logical to return plot to current environment. |
return_data |
logical on returning a .csv of plotted data |
file_name |
name for the output. |
A ggplot2 object when return_plot
is TRUE
, html when dynamic
is TRUE
or .png when dynamic
is FALSE
. Output is saved as file_name
in output_path
.
When file_name
is NULL
, the file name is the ecoregion.
When output_path
is NULL
, the file is saved to "~/".
Stocks are linked to ecoregions and fish categories via the ICES Stock database. Reference points are as published in ICES Stock Assessment Graphs database. In some cases, status relative to reference points may vary from published ICES advice when reported F or SSB are very close to reference points (e.g., F = 0.201 > F<sub>MSY</sub> = 0.20). There is an assumption that discard rates for biannual stocks and are consistent over the years that we don't provide new advice.
Scott Large
## Not run: guild_discards_fun("Greater North Sea Ecoregion", return_plot = TRUE) ## End(Not run)
## Not run: guild_discards_fun("Greater North Sea Ecoregion", return_plot = TRUE) ## End(Not run)
ices_catch_data
returns a data frame of landings by country, species, and fish category
ices_catch_data()
ices_catch_data()
a data frame of landings by country, species, and fish category.
Scott Large
Used in ices_catch_plot
to create an area or line plot of landings (historic and official catch)
for an ecoregion by country, fish category, or species.
Input data: ices_catch_official_raw
, ices_catch_historical_raw
, species_list_raw
,
and stock_list_raw
.
head(ices_catch_data())
head(ices_catch_data())
Catches in FAO area 27 by country, species, area and year as provided by the national authorities. Source: Eurostat/ICES data compilation of catch statistics - ICES 2011, Copenhagen. Version: 30-11-2011
ices_catch_historical_raw
ices_catch_historical_raw
A data frame with 28582 rows and 64 variables:
CountryAdd text
SpeciesAdd text
DivisionAdd text
X1950Add text ...
X2010Add text
http://www.ices.dk/marine-data/dataset-collections/Pages/Fish-catch-and-stock-assessment.aspx
Catches in FAO area 27 by country, species, area and year. Source: Eurostat/ICES database on catch statistics - ICES 2017, Copenhagen. Version 12-06-2017
SpeciesAdd text
AreaAdd text
UnitsAdd text
CountryAdd text
X2015Add text
X2014Add text
X2013Add text
X2012Add text
X2011Add text
X2010Add text
X2009Add text
X2008Add text
X2007Add text
X2006Add text
ices_catch_official_raw
ices_catch_official_raw
A data frame with 50203 rows and 14 variables:
http://www.ices.dk/marine-data/dataset-collections/Pages/Fish-catch-and-stock-assessment.aspx
The ices_catch_plot
function returns an area or line plot of landings (historic and official catch) for an ecoregion by country,
guild, or species.
ices_catch_plot(ecoregion, type = c("COMMON_NAME", "COUNTRY", "GUILD")[1], line_count = 4, plot_type = c("line", "area")[1], data_caption = TRUE, output_path = NULL, file_name = "figure2", save_plot = FALSE, return_plot = TRUE, return_data = FALSE, fig.width = 174, fig.height = 68, text.size = 9)
ices_catch_plot(ecoregion, type = c("COMMON_NAME", "COUNTRY", "GUILD")[1], line_count = 4, plot_type = c("line", "area")[1], data_caption = TRUE, output_path = NULL, file_name = "figure2", save_plot = FALSE, return_plot = TRUE, return_data = FALSE, fig.width = 174, fig.height = 68, text.size = 9)
ecoregion |
ecoregion name, e.g. Greater North Sea Ecoregion |
type |
the variable that will be used to group and display data: COMMON_NAME, GUILD, or COUNTRY |
line_count |
number of lines to display |
plot_type |
area or line plot |
data_caption |
print the data source as a caption, boolean. |
output_path |
path for output to live. |
file_name |
name for the output. |
save_plot |
logical to save plot. |
return_plot |
logical to return plot to current environment. |
return_data |
logical on returning a .csv of plotted data |
fig.width |
width pf combined set of plots |
fig.height |
height of combined set of plots |
text.size |
= size of text in plots |
A ggplot2 object when return_plot
is TRUE
or .png when save_plot
is TRUE
.
Output is saved as file_name
in output_path
.
When file_name
is NULL
, the file name is the ecoregion.
When output_path
is NULL
, the file is saved to "~/".
Historic and official nominal catch are actually only the landings and do not account for discards, misreporting, or other potential issues.
Scott Large
## Not run: ices_catch_plot("Greater North Sea Ecoregion", type = "COMMON_NAME", return_plot = TRUE, line_count = 4) ## End(Not run)
## Not run: ices_catch_plot("Greater North Sea Ecoregion", type = "COMMON_NAME", return_plot = TRUE, line_count = 4) ## End(Not run)
ices_shape
ices_shape
A sf data frame with 66 rows and 11 variables.
http://gis.ices.dk/shapefiles/ICES_areas.zip
ices_stock_props
returns a data frame of the proportion of stocks
relative to ICES reference points for fish categories in ecoregions.
ices_stock_props(active_year = active_year, ecoregion = ecoregion, calculate_status = calculate_status, fisheries_guild = fisheries_guild)
ices_stock_props(active_year = active_year, ecoregion = ecoregion, calculate_status = calculate_status, fisheries_guild = fisheries_guild)
active_year |
numeric of the stock database version (year). e.g., 2016 |
ecoregion |
vector of ecoregions to include |
calculate_status |
logical on whether to use raw SAG output to calculate stock status or to use the hard-coded values from stock summary table |
fisheries_guild |
vector of fisheries guilds to include |
returns a data frame of the proportion of stocks relative to ICES reference points for fish categories in ecoregions.
Periodically, ICES adds or removes stocks from the advisory process. The function returns
the SAG reference points and summary table for all published (in SAG) and active stocks for a given year. calculate_status = TRUE
calculates stock status
relative to published reference points. This will represent PA and SBL for ecoregions with proxy reference points. calculate_status = TRUE
takes the
raw icons from published advice. Note, before 2017 not all stocks status tables have been added to the SAG database and only few stocks had MSY proxy reference points.
Scott Large
Used in stockPie_fun
to plot proportion of stocks relative
to ICES reference points for fish categories in all ecoregions.
Input data: From stock_props
.
## Not run: ices_stock_props(2016) ## End(Not run)
## Not run: ices_stock_props(2016) ## End(Not run)
The plot_kobe
function returns a 2 plots: a scatter plot of F/F<sub>MSY</sub> and SSB/MSY B<sub>trigger</sub>
by fish category and ecoregion and a "lollipop" plot of total catch (divided into discards and landings) by stock.
plot_kobe(ecoregion, guild = c("all", "benthic", "demersal", "pelagic", "crustacean", "elasmobranch", "large-scale stocks")[1], active_year = 2016, data_caption = TRUE, output_path = NULL, return_plot = TRUE, return_data = FALSE, save_plot = FALSE, catch_limit = 0, file_name = NULL, plotTitle = NULL, fig.width = 131.32, fig.height = 88.9, units = "mm", res = 300, dynamic = FALSE)
plot_kobe(ecoregion, guild = c("all", "benthic", "demersal", "pelagic", "crustacean", "elasmobranch", "large-scale stocks")[1], active_year = 2016, data_caption = TRUE, output_path = NULL, return_plot = TRUE, return_data = FALSE, save_plot = FALSE, catch_limit = 0, file_name = NULL, plotTitle = NULL, fig.width = 131.32, fig.height = 88.9, units = "mm", res = 300, dynamic = FALSE)
ecoregion |
ecoregion name, e.g. Greater North Sea Ecoregion |
guild |
fish category (options: "all", "benthic", "demersal", "pelagic", "crustacean", "elasmobranch", "large-scale stocks"), e.g. demersal |
active_year |
numeric of the stock database version (year). e.g., 2016 |
data_caption |
print the data source as a caption, boolean. |
output_path |
path for output to live. |
return_plot |
logical to return plot to current environment. |
return_data |
logical on returning a .csv of plotted data |
save_plot |
logical to save plot. |
catch_limit |
lower limit of catch to be included in the plot. Useful to cull the herd if there are many stocks with minimal catch. |
file_name |
name for the output. |
fig.width |
width pf combined set of plots |
fig.height |
height of combined set of plots, |
units |
defaults to "mm" |
res |
defaults to "300" |
dynamic |
logical to generate html output with dynamic features. |
A ggplot2 object when return_plot
is TRUE
, html when dynamic
is TRUE
or .png when dynamic
is FALSE
. Output is saved as file_name
in output_path
.
When file_name
is NULL
, the file name is the ecoregion.
When output_path
is NULL
, the file is saved to "~/".
Stocks are linked to ecoregions and fish categories via the ICES Stock database. Reference points are as published in ICES Stock Assessment Graphs database. In some cases, status relative to reference points may vary from published ICES advice when reported F or SSB are very close to reference points (e.g., F = 0.201 > F<sub>MSY</sub> = 0.20).
Scott Large
## Not run: plot_kobe("Greater North Sea Ecoregion", guild = "demersal", return_plot = TRUE) ## End(Not run)
## Not run: plot_kobe("Greater North Sea Ecoregion", guild = "demersal", return_plot = TRUE) ## End(Not run)
Data from published ICES advice from 2014-2017. Accessed Accessed 5 July 2017. “ICES Stock Assessment Database, 2017/July ICES, Copenhagen”
sag_keys_raw
sag_keys_raw
A data frame with 545 rows and 3 variables:
AssessmentYearAdd text
AssessmentKeyAdd text
StockKeyLabelAdd text
https://standardgraphs.ices.dk/
Data from published ICES advice from 2014-2017. Accessed Accessed 5 July 2017. “ICES Stock Assessment Database, 2017/July ICES, Copenhagen”
sag_refpts_raw
sag_refpts_raw
A data frame with 545 rows and 15 variables:
AssessmentKeyAdd text
StockKeyLabelAdd text
StockDatabaseIDAdd text
StockKeyAdd text
AssessmentYearAdd text
FLimAdd text
FpaAdd text
BpaAdd text
BlimAdd text
FMSYAdd text
MSYBtriggerAdd text
FmanagementAdd text
BmanagementAdd text
RecruitmentAgeAdd text
RecruitmentLengthAdd text
https://standardgraphs.ices.dk/
Data from published ICES advice from 2014-2017. Accessed Accessed 5 July 2017. “ICES Stock Assessment Database, 2017/July. ICES, Copenhagen”
sag_stock_status_raw
sag_stock_status_raw
A data frame with 6163 rows and 13 variables:
AssessmentYearAdd text
AssessmentKeyAdd text
StockKeyLabelAdd text
yearAdd text
statusAdd text
statusiconAdd text
typeAdd text
lineNumberAdd text
lineDescriptionAdd text
fishingPressureAdd text
stockSizeAdd text
stockSizeStatusAdd text
fishingPressureStatusAdd text
https://standardgraphs.ices.dk/
Data from published ICES advice from 2014-2017. Accessed Accessed 5 July 2017. ICES Stock Assessment Database, 2017/July ICES, Copenhagen
sag_summary_raw
sag_summary_raw
A data frame with 20204 rows and 23 variables:
YearAdd text
recruitmentAdd text
high_recruitmentAdd text
low_recruitmentAdd text
low_SSBAdd text
SSBAdd text
high_SSBAdd text
catchesAdd text
landingsAdd text
discardsAdd text
low_FAdd text
FAdd text
high_FAdd text
StockPublishNoteAdd text
FageAdd text
fishstockAdd text
recruitment_ageAdd text
AssessmentYearAdd text
unitsAdd text
stockSizeDescriptionAdd text
stockSizeUnitsAdd text
fishingPressureDescriptionAdd text
fishingPressureUnitsAdd text
https://standardgraphs.ices.dk/
ASFIS list of species includes 12 700 species items selected according to their interest or relation to fisheries and aquaculture. For each species item stored in a record, codes (ISSCAAP group, taxonomic and 3-alpha) and taxonomic information (scientific name, author(s), family, and higher taxonomic classification) are provided.
species_list_raw
species_list_raw
A data frame with 12700 rows and 11 variables:
Version 2-2016
ISSCAAPAdd text
TAXOCODEAdd text
X3A_CODEAdd text
Scientific_nameAdd text
English_nameAdd text
French_nameAdd text
Spanish_nameAdd text
AuthorAdd text
FamilyAdd text
OrderAdd text
Stats_dataAdd text
http://www.fao.org/fishery/collection/asfis/en
stecf_data
returns a data frame of effort and landings by country, species, and fish category
stecf_data()
stecf_data()
a data frame of stock status relative to reference points and catch, discards, and landings by stock for the most recent assessment.
Scott Large
Used in stecf_plot
to create an area or line plot of landings and effort for an ecoregion
by country and guild.
Input data: stecf_effort_raw
and stecf_landings_raw
.
head(stecf_data())
head(stecf_data())
STECF nominal effort from the FDI data call 2016. Accessed 16 March 2017.
stecf_effort_raw
stecf_effort_raw
A data frame with 23993 rows and 13 variables.
measure.calculationadd text
annexadd text
countryadd text
fishing_activityadd text
fishing_capacityadd text
gt_days_at_seaadd text
no_vesselsadd text
nominal_effortadd text
regulated.areaadd text
regulated.gearadd text
speconadd text
vessel.lengthadd text
yearadd text
https://stecf.jrc.ec.europa.eu/dd/effort/graphs-annex
stecf_landings_raw
stecf_landings_raw
A data frame with 530230 rows and 11 variables.
https://stecf.jrc.ec.europa.eu/dd/effort/graphs-annex
The stecf_plot
function returns an area or line plot of landings (historic and official catch) for an ecoregion by country
guild, or species.
stecf_plot(ecoregion, metric = c("EFFORT", "LANDINGS")[1], type = c("GEAR", "COUNTRY")[1], line_count = 4, plot_type = c("line", "area")[1], data_caption = TRUE, file_name = NULL, save_plot = FALSE, output_path = NULL, return_plot = TRUE, return_data = FALSE, fig.width = 174, fig.height = 68, text.size = 9, ...)
stecf_plot(ecoregion, metric = c("EFFORT", "LANDINGS")[1], type = c("GEAR", "COUNTRY")[1], line_count = 4, plot_type = c("line", "area")[1], data_caption = TRUE, file_name = NULL, save_plot = FALSE, output_path = NULL, return_plot = TRUE, return_data = FALSE, fig.width = 174, fig.height = 68, text.size = 9, ...)
ecoregion |
ecoregion name, e.g. Greater North Sea Ecoregion |
metric |
the value to plot e.g., EFFORT or LANDINGS |
type |
the variable that will be used to group and display data: COMMON_NAME, GUILD, or COUNTRY |
line_count |
number of lines to display |
plot_type |
area or line plot |
data_caption |
print the data source as a caption, boolean. |
file_name |
name for the output. |
save_plot |
logical to save plot. |
output_path |
path for output to live. |
return_plot |
logical to return plot to current environment. |
return_data |
logical on returning a .csv of plotted data |
fig.width |
width pf combined set of plots |
fig.height |
height of combined set of plots |
text.size |
= size of text in plots |
A ggplot2 object when return_plot
is TRUE
or .png when save_plot
is TRUE
.
Output is saved as file_name
in output_path
.
When file_name
is NULL
, the file name is the ecoregion.
When output_path
is NULL
, the file is saved to "~/".
Some considerable errors have been identified in the STECF data. Finland and Estonia effort data are not reliable, and Germany recorded an erroneous haul in 2013. These values have been removed.
Scott Large
## Not run: stecf_plot("Greater North Sea Ecoregion", metric = "EFFORT", type = "GEAR", return_plot = TRUE, line_count = 4) ## End(Not run)
## Not run: stecf_plot("Greater North Sea Ecoregion", metric = "EFFORT", type = "GEAR", return_plot = TRUE, line_count = 4) ## End(Not run)
stock_catch
returns a data frame of reference points, catch, discards, and landings by stock over time.
stock_catch(active_year = 2016)
stock_catch(active_year = 2016)
active_year |
numeric of the stock database version (year). e.g., 2016 |
a data frame of reference points, catch, discards, and landings by stock over time.
Stocks are linked to ecoregions and fish categories via the ICES Stock database. Reference points are as published in ICES Stock Assessment Graphs database. In some cases, status relative to reference points may vary from published ICES advice when reported F or SSB are very close to reference points (e.g., F = 0.201 > F<sub>MSY</sub> = 0.20).
Scott Large
Used in guild_discards_fun
for plots of discard rate and landings by fish category for an ecoregion.
Input data: From clean_sag
head(stock_catch(2016))
head(stock_catch(2016))
Data describing ICES Stocks. Accessed 5 July 2017
stock_list_raw
stock_list_raw
A data frame with 1296 rows and 31 variables.
StockDatabaseIDAdd text
StockKeyAdd text
StockKeyLabelAdd text
StockKeyDescriptionAdd text
PreviousStockKeyAdd text
PreviousStockKeyLabelAdd text
ActiveYearAdd text
SpeciesScientificNameAdd text
SpeciesCommonNameAdd text
EcoRegionAdd text
ExpertGroupAdd text
ExpertGroupDescriptionAdd text
AdviceDraftingGroupAdd text
AdviceDraftingGroupDescriptionAdd text
DataCategoryAdd text
YearOfLastAssessmentAdd text
AssessmentFrequencyAdd text
YearOfNextAssessmentAdd text
AssessmentTypeAdd text
AdviceReleaseDateAdd text
AdviceCategoryAdd text
AdviceTypeAdd text
UseOfDiscardsInAdviceAdd text
PABufferAppliedAdd text
TrophicGuildAdd text
FisheriesGuildAdd text
SizeGuildAdd text
PublishedAdd text
GeneratedOnAdd text
SectionNumberAdd text
AssessmentKeyAdd text
stock_props
returns a list of the proportion of stocks
relative to reference points for fish categories in ecoregions.
stock_props(active_year = active_year, ecoregion = ecoregion, calculate_status = calculate_status, fisheries_guild = fisheries_guild, return_clean_sag = FALSE)
stock_props(active_year = active_year, ecoregion = ecoregion, calculate_status = calculate_status, fisheries_guild = fisheries_guild, return_clean_sag = FALSE)
active_year |
numeric of the stock database version (year). e.g., 2016 |
ecoregion |
vector of ecoregions to include |
calculate_status |
logical on whether to use raw SAG output to calculate stock status or to use the hard-coded values from stock summary table |
fisheries_guild |
vector of fisheries guilds to include |
return_clean_sag |
logical to return objects from clean_sag() |
returns a list with the data frame stock_props
of the proportion of stocks relative
to reference points for all ecoregions. When return_clean_sag = TRUE
, sag_complete_summary
and stock_list_frmt
are also returned from clean_sag
.
Periodically, ICES adds or removes stocks from the advisory process. The function returns
the SAG reference points and summary table for all published (in SAG) and active stocks for a given year.calculate_status = TRUE
calculates stock status
relative to published reference points. This will represent PA and SBL for ecoregions with proxy reference points. calculate_status = TRUE
takes the
raw icons from published advice. Note, before 2017 not all stocks status tables have been added to the SAG database and only few stocks had MSY proxy reference points.
Scott Large
Used in ices_stock_props
and ges_stock_props
to evaluate stocks relative
to ICES and GES reference points.
Input data: SAG summary table and reference points come from clean_sag
. frmt_summary_table
evaluates
status relative to reference points and formats the table for .html.
## Not run: stock_props(2016) ## End(Not run)
## Not run: stock_props(2016) ## End(Not run)
stock_status
returns a data frame of stock status relative to reference points and
catch, discards, and landings by stock for the most recent assessment.
stock_status(active_year = 2016)
stock_status(active_year = 2016)
active_year |
numeric of the stock database version (year). e.g., 2016 |
a data frame of stock status relative to reference points and catch, discards, and landings by stock for the most recent assessment.
Stocks are linked to ecoregions and fish categories via the ICES Stock database. Reference points are as published in ICES Stock Assessment Graphs database. In some cases, status relative to reference points may vary from published ICES advice when reported F or SSB are very close to reference points (e.g., F = 0.201 > F<sub>MSY</sub> = 0.20).
Scott Large
Used in plot_kobe
to plot a scatter plot of F/F<sub>MSY</sub> and SSB/MSY B<sub>trigger</sub>
by fish category and ecoregion and a "lollipop" plot of total catch (divided into discards and landings) by stock.
Input data: From stock_catch
head(stock_status(2016))
head(stock_status(2016))
The stock_trends_fun
function returns a series of line plots of F and SSB relative to F<sub>MSY</sub> and MSY B<sub>trigger</sub>
reference points for stocks of a fish category for an ecoregion.
stock_trends_fun(object, plotting_var = c("StockCode", "FisheriesGuild")[1], grouping_var = c("EcoGuild", "EcoRegion", "FisheriesGuild")[1], metric = c("MSY", "MEAN")[1], active_year = 2016, dynamic = FALSE, data_caption = TRUE, file_name = NULL, save_plot = FALSE, return_plot = TRUE, return_data = FALSE, output_path = NULL, stackable = FALSE)
stock_trends_fun(object, plotting_var = c("StockCode", "FisheriesGuild")[1], grouping_var = c("EcoGuild", "EcoRegion", "FisheriesGuild")[1], metric = c("MSY", "MEAN")[1], active_year = 2016, dynamic = FALSE, data_caption = TRUE, file_name = NULL, save_plot = FALSE, return_plot = TRUE, return_data = FALSE, output_path = NULL, stackable = FALSE)
object |
name of data to plot. Must agree with the grouping_var argument. E.g., EcoGuild must be the combined ecoregion name and fish category, e.g. "Greater North Sea Ecoregion - demersal stocks" |
plotting_var |
character string of the variable to plot. Options include: StockCode or FisheriesGuild (mean) |
grouping_var |
character string of the desired grouping. Options include: EcoRegion, EcoGuild, or FisheriesGuild |
metric |
character string of the desired metric. Options include: MSY or MEAN (according to grouping_var) |
active_year |
numeric of the stock database version (year). e.g., 2016 |
dynamic |
logical to generate html output with dynamic features. |
data_caption |
print the data source as a caption, boolean. |
file_name |
name for the output. |
save_plot |
logical to save plot. |
return_plot |
logical to return plot to current environment. |
return_data |
logical on returning a .csv of plotted data |
output_path |
path for output to live. |
A ggplot2 object when return_plot
is TRUE
, html when dynamic
is TRUE
or .png when dynamic
is FALSE
. Output is saved as file_name
in output_path
.
When file_name
is NULL
, the file name is the ecoregion.
When output_path
is NULL
, the file is saved to "~/".
Stocks are linked to ecoregions and fish categories via the ICES Stock database. Reference points are as published in ICES Stock Assessment Graphs database. In some cases, status relative to reference points may vary from published ICES advice when reported F or SSB are very close to reference points (e.g., F = 0.201 > F<sub>MSY</sub> = 0.20).
Scott Large
## Not run: stock_trends_fun(object = "Greater North Sea Ecoregion - demersal", grouping_var = "EcoGuild", return_plot = TRUE) ## End(Not run)
## Not run: stock_trends_fun(object = "Greater North Sea Ecoregion - demersal", grouping_var = "EcoGuild", return_plot = TRUE) ## End(Not run)
The stockPie_fun
function returns pie charts of the proportion of stocks
relative to reference points for fish categories in an ecoregion.
stockPie_fun(ecoregion, fisheries_guild = c("pelagic", "demersal", "crustacean", "elasmobranch", "benthic"), calculate_status = FALSE, data_caption = TRUE, file_name, active_year = 2016, save_plot = FALSE, return_plot = TRUE, return_data = FALSE, output_path = NULL)
stockPie_fun(ecoregion, fisheries_guild = c("pelagic", "demersal", "crustacean", "elasmobranch", "benthic"), calculate_status = FALSE, data_caption = TRUE, file_name, active_year = 2016, save_plot = FALSE, return_plot = TRUE, return_data = FALSE, output_path = NULL)
ecoregion |
ecoregion name, e.g. Greater North Sea |
fisheries_guild |
fisheries guild to include in proportions |
calculate_status |
logical on whether to use raw SAG output to calculate stock status or to use the hard-coded values from stock summary table |
data_caption |
print the data source as a caption, boolean. |
file_name |
name for the output. |
active_year |
numeric of the stock database version (year). e.g., 2016 |
save_plot |
logical to save plot. |
return_plot |
logical to return plot to current environment. |
return_data |
logical on returning a .csv of plotted data |
output_path |
path for output to live. |
A ggplot2 object or .png saved as file_name
to output_path
.
When file_name
is NULL
, the file name is the ecoregion.
When output_path
is NULL
, the file is saved to "~/".
Stocks are linked to ecoregions and fish categories via the ICES Stock database.
Reference points are as published in ICES Stock Assessment Graphs database. In some cases,
status relative to reference points may vary from published ICES advice
when reported F or SSB are very close to reference points (e.g., F = 0.201 > F<sub>MSY</sub> = 0.20). calculate_status = TRUE
calculates stock status
relative to published reference points. This will represent PA and SBL for ecoregions with proxy reference points. calculate_status = TRUE
takes the
raw icons from published advice. Note, before 2017 not all stocks status tables have been added to the SAG database and only few stocks had MSY proxy reference points.
Scott Large
## Not run: stockPie_fun("Greater North Sea Ecoregion", return_plot = TRUE) ## End(Not run)
## Not run: stockPie_fun("Greater North Sea Ecoregion", return_plot = TRUE) ## End(Not run)
This function returns "Status of stock summary relative to reference points" for all stocks in an ecoregion.
stockSummaryTable_fun(ecoregion, active_year = 2016, table_type = c("static_docx", "dynamic_html")[1], output_path = NULL, file_name = NULL, return_data = FALSE)
stockSummaryTable_fun(ecoregion, active_year = 2016, table_type = c("static_docx", "dynamic_html")[1], output_path = NULL, file_name = NULL, return_data = FALSE)
ecoregion |
ecoregion name, e.g. Greater North Sea |
active_year |
numeric of the stock database version (year). e.g., 2016 |
table_type |
type of table, "dynamic_html" (using DT) and "static_docx" (using |
output_path |
path for output to live. |
file_name |
name for the output. |
return_data |
logical on returning a .csv of plotted data |
A html file. When file_name
is NULL
, the file name is the ecoregion.
When output_path
is NULL
, the file is saved to "~/". When table_type
is "static"
or "both"
,
it might take a bit of time...
Stocks are linked to ecoregions via the ICES Stock database. Reference points are as published in ICES Stock Assessment Graphs database. In some cases, status relative to reference points may vary from published ICES advice when reported F or SSB are very close to reference points (e.g., F = 0.201 > F<sub>MSY</sub> = 0.20).
Periodically, ICES adds or removes stocks from the advisory process. The function returns the SAG reference points and summary table for all published (in SAG) and active stocks for a given year.
Scott Large
SAG summary table and reference points come from clean_sag
. frmt_summary_table
evaluates
status relative to reference points and formats the table for .html.
## Not run: stockSummaryTable_fun("Greater North Sea Ecoregion") ## End(Not run)
## Not run: stockSummaryTable_fun("Greater North Sea Ecoregion") ## End(Not run)