Using MRIP Data for Recreational Indicators
Stephanie Owen & Abigail Tyrell
Source:vignettes/using_mrip_data.Rmd
using_mrip_data.Rmd
Obtaining MRIP Data
Data pulls from NOAA Fisheries’ Marine Recreational Information Program (MRIP) can be done through the MRIP Query Tool website.
Alternatively, queries for recreational trips, catch, and landings can be performed using the functions in this package.
This vignette shows example data pulls and plots used for Black Sea Bass:
Total Recreational Catch and Landings
Total Recreational Trips
Black Sea Bass Recreational Catch and Landings
Pull data
Get recreational catch data for Black Sea Bass using the
get_mrip_catch
function. The type
argument can
be set to “all” for all catch types (A, B1, B2) or “landings” for just
the landings (A and B1).
bsb_catch <- get_mrip_catch(species = "BLACK SEA BASS", type = "all")
head(bsb_catch)
## $data
## # A tibble: 44 × 13
## `Estimate Status` Year `Fishing Year` `Common Name` `Cumulative Through`
## <chr> <int> <chr> <chr> <chr>
## 1 FINAL 1981 CALENDAR YEAR (JA… BLACK SEA BA… ANNUAL
## 2 FINAL 1982 CALENDAR YEAR (JA… BLACK SEA BA… ANNUAL
## 3 FINAL 1983 CALENDAR YEAR (JA… BLACK SEA BA… ANNUAL
## 4 FINAL 1984 CALENDAR YEAR (JA… BLACK SEA BA… ANNUAL
## 5 FINAL 1985 CALENDAR YEAR (JA… BLACK SEA BA… ANNUAL
## 6 FINAL 1986 CALENDAR YEAR (JA… BLACK SEA BA… ANNUAL
## 7 FINAL 1987 CALENDAR YEAR (JA… BLACK SEA BA… ANNUAL
## 8 FINAL 1988 CALENDAR YEAR (JA… BLACK SEA BA… ANNUAL
## 9 FINAL 1989 CALENDAR YEAR (JA… BLACK SEA BA… ANNUAL
## 10 FINAL 1990 CALENDAR YEAR (JA… BLACK SEA BA… ANNUAL
## # ℹ 34 more rows
## # ℹ 8 more variables: `PSE Total Catch (A+B1+B2)` <dbl>,
## # `Does Total Catch (A+B1+B2) Meet MRIP Standard` <chr>,
## # `Is Total Catch (A+B1+B2) Significantly Different From 0` <chr>,
## # `Total Catch (A+B1+B2)` <chr>,
## # `Total Catch (A+B1+B2) Lower 95% Confidence Limit` <chr>,
## # `Total Catch (A+B1+B2) Upper 95% Confidence Limit` <chr>, …
##
## $metadata
## [1] " Your Query Parameters: Query: MRIP CATCH TIME SERIES Year: 1981 - 2024 Summarize By: ANNUAL Fishing Year: CALENDAR YEAR (JANUARY 1 - DECEMBER 31) Species: BLACK SEA BASS Geographic Area: NORTH AND MID-ATLANTIC Fishing Mode: ALL MODES COMBINED Fishing Area: ALL AREAS COMBINED Type of Catch: TOTAL CATCH (TYPE A + B1 + B2) Information: NUMBERS OF FISHNotes on Query Results: MRIP does not support the use of estimates with a percent standard error above 50 and in those instances, recommends considering higher levels of aggregation (e.g., across states, geographic regions, or fishing modes).Due to COVID-related disruptions to the Access Point Angler Intercept Survey and subsequent gaps in catch records, some catch estimates are based in part on imputed data. Columns labeled 'Contribution of Imputed Data to {ESTIMATE} rate' represent the weighted percentage of catch rate information that can be attributed to imputed catch data. Note: This does *not* represent the percent difference between the estimate with and without imputed data incorporated. If no such column appears in your query results, no imputed data were used.Estimates for Hawaii (prior to 2023) and Puerto Rico (prior to 2014) are based on Marine Recreational Fisheries Statistics Survey methodology and have not been calibrated. Beginning in 2023, estimates for Hawaii are produced using certified MRIP survey designs and weighted estimation methods. \n Return to Query Page\n"
bsb_landings <- get_mrip_catch(species = "BLACK SEA BASS", type = "landings")
head(bsb_landings)
## $data
## # A tibble: 44 × 13
## `Estimate Status` Year `Fishing Year` `Common Name` `Cumulative Through`
## <chr> <int> <chr> <chr> <chr>
## 1 FINAL 1981 CALENDAR YEAR (JA… BLACK SEA BA… ANNUAL
## 2 FINAL 1982 CALENDAR YEAR (JA… BLACK SEA BA… ANNUAL
## 3 FINAL 1983 CALENDAR YEAR (JA… BLACK SEA BA… ANNUAL
## 4 FINAL 1984 CALENDAR YEAR (JA… BLACK SEA BA… ANNUAL
## 5 FINAL 1985 CALENDAR YEAR (JA… BLACK SEA BA… ANNUAL
## 6 FINAL 1986 CALENDAR YEAR (JA… BLACK SEA BA… ANNUAL
## 7 FINAL 1987 CALENDAR YEAR (JA… BLACK SEA BA… ANNUAL
## 8 FINAL 1988 CALENDAR YEAR (JA… BLACK SEA BA… ANNUAL
## 9 FINAL 1989 CALENDAR YEAR (JA… BLACK SEA BA… ANNUAL
## 10 FINAL 1990 CALENDAR YEAR (JA… BLACK SEA BA… ANNUAL
## # ℹ 34 more rows
## # ℹ 8 more variables: `PSE Total Harvest (A+B1)` <dbl>,
## # `Does Total Harvest (A+B1) Meet MRIP Standard` <chr>,
## # `Is Total Harvest (A+B1) Significantly Different From 0` <chr>,
## # `Total Harvest (A+B1)` <chr>,
## # `Total Harvest (A+B1) Lower 95% Confidence Limit` <chr>,
## # `Total Harvest (A+B1) Upper 95% Confidence Limit` <chr>, …
##
## $metadata
## [1] " Your Query Parameters: Query: MRIP CATCH TIME SERIES Year: 1981 - 2024 Summarize By: ANNUAL Fishing Year: CALENDAR YEAR (JANUARY 1 - DECEMBER 31) Species: BLACK SEA BASS Geographic Area: NORTH AND MID-ATLANTIC Fishing Mode: ALL MODES COMBINED Fishing Area: ALL AREAS COMBINED Type of Catch: HARVEST (TYPE A + B1) Information: NUMBERS OF FISHNotes on Query Results: MRIP does not support the use of estimates with a percent standard error above 50 and in those instances, recommends considering higher levels of aggregation (e.g., across states, geographic regions, or fishing modes).Due to COVID-related disruptions to the Access Point Angler Intercept Survey and subsequent gaps in catch records, some catch estimates are based in part on imputed data. Columns labeled 'Contribution of Imputed Data to {ESTIMATE} rate' represent the weighted percentage of catch rate information that can be attributed to imputed catch data. Note: This does *not* represent the percent difference between the estimate with and without imputed data incorporated. If no such column appears in your query results, no imputed data were used.Estimates for Hawaii (prior to 2023) and Puerto Rico (prior to 2014) are based on Marine Recreational Fisheries Statistics Survey methodology and have not been calibrated. Beginning in 2023, estimates for Hawaii are produced using certified MRIP survey designs and weighted estimation methods. \n Return to Query Page\n"
Wrangle data
The function returns a list with the data and query metadata. These
data can be used directly for analyses, with minimal data wrangling. The
data can be formatted for use in ESPs with the function
create_total_rec_catch()
.
esp_catch <- create_total_rec_catch(bsb_catch$data,
var_name = "catch"
)
head(esp_catch) |>
knitr::kable()
YEAR | DATA_VALUE | CATEGORY | INDICATOR_TYPE | INDICATOR_NAME | INDICATOR_UNITS | SPECIES |
---|---|---|---|---|---|---|
1981 | 7680855 | Recreational | Socioeconomic | total_recreational_catch_n | number | BLACK SEA BASS |
1982 | 12824985 | Recreational | Socioeconomic | total_recreational_catch_n | number | BLACK SEA BASS |
1983 | 8172372 | Recreational | Socioeconomic | total_recreational_catch_n | number | BLACK SEA BASS |
1984 | 4566246 | Recreational | Socioeconomic | total_recreational_catch_n | number | BLACK SEA BASS |
1985 | 8973265 | Recreational | Socioeconomic | total_recreational_catch_n | number | BLACK SEA BASS |
1986 | 29444111 | Recreational | Socioeconomic | total_recreational_catch_n | number | BLACK SEA BASS |
esp_landings <- create_total_rec_catch(bsb_landings$data,
var_name = "landings"
)
head(esp_landings) |>
knitr::kable()
YEAR | DATA_VALUE | CATEGORY | INDICATOR_TYPE | INDICATOR_NAME | INDICATOR_UNITS | SPECIES |
---|---|---|---|---|---|---|
1981 | 2387527 | Recreational | Socioeconomic | total_recreational_landings_n | number | BLACK SEA BASS |
1982 | 10696079 | Recreational | Socioeconomic | total_recreational_landings_n | number | BLACK SEA BASS |
1983 | 5075429 | Recreational | Socioeconomic | total_recreational_landings_n | number | BLACK SEA BASS |
1984 | 2447169 | Recreational | Socioeconomic | total_recreational_landings_n | number | BLACK SEA BASS |
1985 | 4491941 | Recreational | Socioeconomic | total_recreational_landings_n | number | BLACK SEA BASS |
1986 | 19254567 | Recreational | Socioeconomic | total_recreational_landings_n | number | BLACK SEA BASS |
Save data
If you would like to save the data, the save_catch
function can be used to save the data and the query used as an Rds file.
This function is useful for automating data pulls and saving them in a
specified folder. The file names are automatically generated, and are
printed when the function runs. The function returns the file name as a
value, which can be used to read the data back in later.
save_catch(
this_species = "black sea bass",
out_folder = here::here("inst/mrip_data"),
catch_type = "all"
)
## Data saved at: C:/Users/abigail.tyrell/Documents/code/READ-EDAB-NEesp2/inst/mrip_data/catch_all_black_sea_bass.Rds
## [1] "C:/Users/abigail.tyrell/Documents/code/READ-EDAB-NEesp2/inst/mrip_data/catch_all_black_sea_bass.Rds"
save_catch(
this_species = "black sea bass",
out_folder = here::here("inst/mrip_data"),
catch_type = "landings"
)
## Data saved at: C:/Users/abigail.tyrell/Documents/code/READ-EDAB-NEesp2/inst/mrip_data/catch_landings_black_sea_bass.Rds
## [1] "C:/Users/abigail.tyrell/Documents/code/READ-EDAB-NEesp2/inst/mrip_data/catch_landings_black_sea_bass.Rds"
Plot data
The data can be plotted with plt_indicator()
as long as
it has columns named INDICATOR_NAME, DATA_VALUE, and YEAR.
plt_indicator(esp_catch)
plt_indicator(esp_landings)
Suggested workflow
We suggest using save_catch()
to save the data, reading
in the .Rds, and formatting using create_total_rec_catch()
to format the data for use in ESPs. This allows for easy access to the
data and metadata, and ensures that the data is in a consistent format
for analysis.
save_data <- save_catch(
this_species = "black sea bass",
out_folder = here::here(),
catch_type = "all"
)
data <- readRDS(save_data)
esp_catch <- create_total_rec_catch(bsb_catch$data)
This workflow can also be easily iterated over multiple species with
purrr::map()
.
species_list <- c("black sea bass", "summer flounder", "scup")
purrr::map(
species_list,
~ {
save_data <- save_catch(
this_species = .x,
out_folder = here::here(),
catch_type = "all"
)
data <- readRDS(save_data)
esp_catch <- create_total_rec_catch(data$data)
write.csv(esp_catch, here::here(paste0("esp_catch_", .x, ".csv")))
}
)
Black Sea Bass Total Recreational Trips
Recreational trip queries must be done by year (single query for each year). The earliest possible year is 1981. Additionally, each region must be queried separately (i.e. Mid-Atlantic and North Atlantic, or by state).
Simple queries
Here is a sample query for Black Sea Bass trips in the North Atlantic in 2020.
trips_2020 <- get_mrip_trips(species = "BLACK SEA BASS", region = "North Atlantic", year = "2020")
trips_2020
## $data
## # A tibble: 1 × 13
## `Estimate Status` Year `Fishing Year` Estimation Methodolog…¹
## <chr> <int> <chr> <chr>
## 1 FINAL 2020 Calendar Year (Jan 1 - Dec 31) MRIP (2020 - 2020)
## # ℹ abbreviated name: ¹`Estimation Methodology`
## # ℹ 9 more variables: `Cumulative Through` <chr>, PSE <dbl>,
## # `Does Directed Trips Meet MRIP Standard` <chr>,
## # `Is Directed Trips Significantly Different From 0` <chr>,
## # `Directed Trips` <chr>, `Directed Trips Lower 95% Confidence Limit` <chr>,
## # `Directed Trips Upper 95% Confidence Limit` <chr>, Species <fct>,
## # Region <fct>
##
## $metadata
## [1] " Your Query Parameters: Query: MRIP EFFORT DIRECTED TRIP Year: 2020 - 2020 Summarize By: ANNUAL Fishing Year: CALENDAR YEAR (JANUARY 1 - DECEMBER 31) Species: BLACK SEA BASS Geographic Area: NORTH ATLANTIC Fishing Mode: ALL MODES COMBINED Fishing Area: ALL AREAS COMBINED Species Option: PRIMARY TARGET, SECONDARY TARGET, CAUGHT (TYPE A), HARVESTED (TYPE B1), RELEASED (TYPE B2) Information: DIRECTED ANGLER TRIPSNotes on Query Results: MRIP does not support the use of estimates with a percent standard error above 50 and in those instances, recommends considering higher levels of aggregation (e.g., across states, geographic regions, or fishing modes). Results from 1981-2017 contain estimates resulting from the full application of both the Access Point Angler Intercept Survey (APAIS) and Fishing Effort Survey (FES) calibration. As of 2018 wave 1, all estimates of shore and private/rental boat fishing effort are now based on the FES. MRIP estimates for Louisiana are not available after 2013. State produced estimates are available through the MRIP National Query. For more information on state run surveys and estimates, please click here. Estimates for Hawaii (prior to 2023) and Puerto Rico (prior to 2014) are based on Marine Recreational Fisheries Statistics Survey methodology and have not been calibrated. Beginning in 2023, estimates for Hawaii are produced using certified MRIP survey designs and weighted estimation methods. Review the glossary for a description of how the for-hire survey methods have changed over time. \n Return to Query Page\n"
To build a time series, multiple queries need to be run. Trips could be manually downloaded and combined, as shown below. The following queries Black Sea Bass trips for the North Atlantic and Mid-Atlantic from 2020-2024.
trips_2020 <- get_mrip_trips(species = "BLACK SEA BASS", region = "North Atlantic", year = "2020")
trips_2021 <- get_mrip_trips(species = "BLACK SEA BASS", region = "North Atlantic", year = "2021")
trips_2022 <- get_mrip_trips(species = "BLACK SEA BASS", region = "North Atlantic", year = "2022")
trips_2023 <- get_mrip_trips(species = "BLACK SEA BASS", region = "North Atlantic", year = "2023")
trips_2024 <- get_mrip_trips(species = "BLACK SEA BASS", region = "North Atlantic", year = "2024")
trips2_2020 <- get_mrip_trips(species = "BLACK SEA BASS", region = "Mid-Atlantic", year = "2020")
trips2_2021 <- get_mrip_trips(species = "BLACK SEA BASS", region = "Mid-Atlantic", year = "2021")
trips2_2022 <- get_mrip_trips(species = "BLACK SEA BASS", region = "Mid-Atlantic", year = "2022")
trips2_2023 <- get_mrip_trips(species = "BLACK SEA BASS", region = "Mid-Atlantic", year = "2023")
trips2_2024 <- get_mrip_trips(species = "BLACK SEA BASS", region = "Mid-Atlantic", year = "2024")
n_trips <- rbind(
trips_2020$data,
trips_2021$data,
trips_2022$data,
trips_2023$data,
trips_2024$data
)
mid_trips <- rbind(
trips2_2020$data,
trips2_2021$data,
trips2_2022$data,
trips2_2023$data,
trips2_2024$data
)
head(n_trips)
## # A tibble: 5 × 13
## `Estimate Status` Year `Fishing Year` Estimation Methodolog…¹
## <chr> <int> <chr> <chr>
## 1 FINAL 2020 Calendar Year (Jan 1 - Dec 31) MRIP (2020 - 2020)
## 2 FINAL 2021 Calendar Year (Jan 1 - Dec 31) MRIP (2021 - 2021)
## 3 FINAL 2022 Calendar Year (Jan 1 - Dec 31) MRIP (2022 - 2022)
## 4 FINAL 2023 Calendar Year (Jan 1 - Dec 31) MRIP (2023 - 2023)
## 5 FINAL 2024 Calendar Year (Jan 1 - Dec 31) MRIP (2024 - 2024)
## # ℹ abbreviated name: ¹`Estimation Methodology`
## # ℹ 9 more variables: `Cumulative Through` <chr>, PSE <dbl>,
## # `Does Directed Trips Meet MRIP Standard` <chr>,
## # `Is Directed Trips Significantly Different From 0` <chr>,
## # `Directed Trips` <chr>, `Directed Trips Lower 95% Confidence Limit` <chr>,
## # `Directed Trips Upper 95% Confidence Limit` <chr>, Species <fct>,
## # Region <fct>
Save data
To make the data download more reproducible and efficient, there is a
save_trips()
function that can be iterated on with
purrr::map()
. This function executes the MRIP query and
saves the .Rds with the MRIP data download and query information in the
specified folder. Data can then be read in and used in analyses. For
example, the following code will download and save the same data that is
shown in the trips_2020
object above. The file name is
automatically created and is returned by the function.
save_trips(
this_species = "BLACK SEA BASS",
this_year = 2020,
this_region = "North Atlantic",
out_folder = here::here("inst/mrip_data")
)
## MRIP query successful: BLACK SEA BASS North Atlantic 2020
## Data saved at: C:/Users/abigail.tyrell/Documents/code/READ-EDAB-NEesp2/inst/mrip_data/BLACK_SEA_BASS_trips/trips_BLACK_SEA_BASS_North_Atlantic_2020.Rds
## [1] "C:/Users/abigail.tyrell/Documents/code/READ-EDAB-NEesp2/inst/mrip_data/BLACK_SEA_BASS_trips/trips_BLACK_SEA_BASS_North_Atlantic_2020.Rds"
Automate data pulls with save_trips()
To iterate with purrr::map()
:
# create parameter grid
params <- expand.grid(
region = c("north atlantic", "mid-atlantic"),
year = c(2020:2024),
species = "Black sea bass"
)
# iterate
purrr::map(
purrr::list_transpose(list(
region = params$region,
year = params$year,
species = params$species
)),
~ try(NEesp2::save_trips(
this_species = .x$species,
this_year = .x$year,
this_region = .x$region,
out_folder = here::here()
))
)
Please note that iterating over a large number of species and years
may fail. Since data is saved as it is queried, progress will be saved
and can be resumed by adjusting params
running the function
again.
Wrangle data
After the MRIP trip data has been saved, it can be easily turned into
a data frame using the create_rec_trips
function. This
function takes a single argument, which is the list of files to be
combined. Note that this function will automatically combine the data
from multiple regions, so if you would like to create region-specific
indicators, you must run the function over two separate lists of
files.
esp_trips <- create_rec_trips(
files = list.files(system.file("mrip_data", package = "NEesp2"),
pattern = "trips_Black_sea_bass*",
recursive = TRUE,
full.names = TRUE
)
)
esp_trips |>
knitr::kable()
YEAR | DATA_VALUE | CATEGORY | INDICATOR_TYPE | INDICATOR_NAME | INDICATOR_UNITS | SPECIES |
---|---|---|---|---|---|---|
2020 | 6750639 | Recreational | Socioeconomic | rec_trips | number | Black sea bass |
2021 | 6840012 | Recreational | Socioeconomic | rec_trips | number | Black sea bass |
2022 | 7528515 | Recreational | Socioeconomic | rec_trips | number | Black sea bass |
2023 | 6915482 | Recreational | Socioeconomic | rec_trips | number | Black sea bass |
2024 | 5947798 | Recreational | Socioeconomic | rec_trips | number | Black sea bass |