Skip to content

Commit d81a2df

Browse files
author
Carly Lovas
committed
updates
1 parent b1c0e6b commit d81a2df

14 files changed

Lines changed: 2918 additions & 104 deletions

R/mrip.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pull_mrip_catch <- function(proj_path){
4242
)
4343

4444
region_levels <- c(
45-
"North Atlantic",
45+
"New England",
4646
"Mid Atlantic",
4747
"South Atlantic",
4848
"Gulf of Mexico"
@@ -56,6 +56,7 @@ pull_mrip_catch <- function(proj_path){
5656
dplyr::mutate(common_name = tolower(common_name),
5757
state = stringr::str_to_title(state),
5858
state = factor(state, levels = states_ns),
59+
region = str_replace(region, "North Atlantic", "New England"),
5960
region = factor(region, levels = region_levels))
6061

6162
data <- data |>

R/nefsc.R

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ pull_nefsc <- function(proj_path){
103103
#' @export
104104
#' @examples # map_nefsc_cob(species = "black sea bass", data = nefsc)
105105

106-
map_nefsc_cob <- function(species = "all", data = "nefsc"){
106+
map_nefsc_cob <- function(species = "all", data = NULL){
107107

108108
# Get species list
109-
species_list <- species.shift::species_list(source = "nefsc")
109+
species_list <- species.shifts::species_list(source = "nefsc")
110110

111111
# Base filter
112112
data <- data |>
@@ -195,6 +195,8 @@ map_nefsc_cob <- function(species = "all", data = "nefsc"){
195195
}
196196
}
197197

198+
# ggsave(filename = here::here("summer flounder cob map.png"), map_nefsc_cob(species = "summer flounder", data = nefsc), width = 13)
199+
198200
## Seasonal percentile plots
199201
#' @title Plot edges of distribution
200202
#'
@@ -206,10 +208,10 @@ map_nefsc_cob <- function(species = "all", data = "nefsc"){
206208
#' @export
207209
#' @examples # plot_nefsc_edges(species = "summer flounder", data = nefsc)
208210

209-
plot_nefsc_edges <- function(species = "all", data = "nefsc"){
211+
plot_nefsc_edges <- function(species = "all", data = NULL){
210212

211213
# Get species list
212-
species_list <- species.shift::species_list(source = "nefsc")
214+
species_list <- species.shifts::species_list(source = "nefsc")
213215

214216
# Base filter
215217
data <- data |>
@@ -280,6 +282,7 @@ plot_nefsc_edges <- function(species = "all", data = "nefsc"){
280282
}
281283
}
282284

285+
283286
## Distance between centroids
284287
#' @title Plot NEFSC Bottom Trawl Center of Biomass
285288
#'
@@ -291,10 +294,10 @@ plot_nefsc_edges <- function(species = "all", data = "nefsc"){
291294
#' @export
292295
#' @examples # plot_nefsc_centers(species = "black sea bass", data = nefsc)
293296

294-
plot_nefsc_centers <- function(species = "all", data = "nefsc"){
297+
plot_nefsc_centers <- function(species = "all", data = NULL){
295298

296299
# Get species list
297-
species_list <- species.shift::species_list(source = "nefsc")
300+
species_list <- species.shifts::species_list(source = "nefsc")
298301

299302
# Base filter
300303
data <- data |>
@@ -368,12 +371,12 @@ plot_nefsc_centers <- function(species = "all", data = "nefsc"){
368371
#' @param data Default is "nefsc" `nefsc` must be run and named "observer" in order to run this function.
369372
#' @return Map of distribution of biomass along the Northeast US. Selecting `all` species will return a list.
370373
#' @export
371-
#' @examples # map_nefsc(species = "summer flounder", data = "nefsc")
374+
#' @examples # map_nefsc(species = "summer flounder", data = nefsc)
372375
#'
373-
map_nefsc <- function(species = "all", data = "nefsc"){
376+
map_nefsc <- function(species = "all", data = NULL){
374377

375378
# Get species list
376-
species_list <- species.shift::species_list(source = "nefsc")
379+
species_list <- species.shifts::species_list(source = "nefsc")
377380

378381
# Base filter
379382
data <- data |>
@@ -474,3 +477,4 @@ map_nefsc <- function(species = "all", data = "nefsc"){
474477
return(plots$out[[1]])
475478
}
476479
}
480+

R/permits.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
#' @title Pull federal permits data
88
#'
9-
#' @description Function to pull, clean and geocode GARFO commercial fishing permits from pre-existing confidential repository. Note that due to spelling error, geocoding principal ports removes 1% of permit entries, and takes approximately 25 minutes to run.
9+
#' @description Function to pull, clean and geocode GARFO commercial fishing permits from pre-existing confidential repository. Note that due to spelling error, geocoding principal ports removes `1%` of permit entries, and takes approximately 25 minutes to run.
1010
#'
11-
#' @param proj_path Local path to data file
11+
#' @param proj_path Local path to data folder. Note that this code is designed to read in multiple Excel files from a single folder, as each year is its own Excel file. If other Excel files are included in the same location, this function will not be able to discern it from the permits data and will not run.
1212
#' @return Data frame of permits; includes year, prinicpal port and state, permit type, target species, and category (commerical, for-hire).
1313
#' @export
1414
#' @examples # permits <- pull_permits(proj_path = proj_path)
@@ -229,7 +229,7 @@ pull_permits <- function(proj_path){
229229
#'
230230
#' @examples # plot_state_permits(species = "summer flounder", data = permits)
231231

232-
plot_state_permits <- function(species = "all", data = "permits") {
232+
plot_state_permits <- function(species = "all", data = NULL) {
233233

234234

235235
# Get species list

R/vtr.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#'
77
#' @description Function to pull and clean Vessel Trip Reports from pre-existing confidential repository.
88
#'
9-
#' @param proj_path Local path to data file
9+
#' @param proj_path Local path to data folder. Note that VTR data was provided in multiple CSV files. This function is designed to read all CSV files within a central location. If other CSVs are stored in the same location as the VTR, this function will not be able to discern the different data and will not run.
1010
#' @return Data frame of vessel trip reports; includes year, sub_trip_id, latitude, longitude, port name and state, species caught, weight of kept and discarded catch.
1111
#' @export
1212
#' @examples # not run
@@ -58,15 +58,15 @@ pull_vtr <- function(proj_path){
5858
#' @param data Default is "vtr." `pull_vtr` must be run and named "vtr" in order to run this function.
5959
#' @return Map of distribution of observed kept catch along the Northeast US. Selecting `all` species will return a list.
6060
#' @export
61-
#' @examples # map_vtr(species = "summer flounder", data = "vtr")
61+
#' @examples # map_vtr(species = "summer flounder", data = vtr)
6262
#'
63-
map_vtr <- function(species = "all", data = "vtr"){
63+
map_vtr <- function(species = "all", data = NULL){
6464

6565
# Get species list
6666
species_list <- species.shifts::species_list(source = "vtr")
6767

6868
# Base filter
69-
data <- vtr |>
69+
data <- data |>
7070
dplyr::mutate(comname = tolower(species_name),
7171
decade = 10*year%/%10) |>
7272
dplyr::right_join(species_list)

images/summer flounder catch.png

13.9 KB
Loading

images/summer flounder centers.png

162 KB
Loading

images/summer flounder cob map.png

668 KB
Loading

images/summer flounder edges.png

300 KB
Loading
1.28 MB
Loading

vignettes/indicators.html

Lines changed: 2624 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)