Skip to content

Commit ae5d9bd

Browse files
committed
Deploying to gh-pages from @ carlylovas/species.shifts@42b2563 🚀
1 parent f22db40 commit ae5d9bd

5 files changed

Lines changed: 98 additions & 17 deletions

File tree

articles/data_cleaning_functions.html

Lines changed: 17 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

articles/data_cleaning_functions.md

Lines changed: 78 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ to the area between -60 and -80 degrees west and 20 degrees north.
7474
The data that is returned includes all that is shown above, and
7575
`sub_trip_id` as the unique trip identifier.
7676

77+
------------------------------------------------------------------------
78+
7779
### Fisheries Observer
7880

7981
`observer <- pull_observer(proj_path = my_path)`
@@ -87,7 +89,7 @@ The data that is returned includes all that is shown above, and
8789
\*Trip ID information removed from demo to maintain confidentiality.
8890

8991
**How it works:** The fisheries observer information was received from
90-
the \*\*Northeast Fisheries Science Center\* as a Microsoft Excel
92+
the **Northeast Fisheries Science Center** as a Microsoft Excel
9193
Workbook. The data spans 1989 to 2024 and contains trip, haul and catch
9294
data from that time frame. The haul data is broken up into two separate
9395
sheets within the excel workbook. Catch data is stored within individual
@@ -107,6 +109,8 @@ capture the proper recorded coordinates to each trip. This list is then
107109
joined back to the combined catch-haul data set to ensure accurate
108110
coordinates based on trip type.
109111

112+
------------------------------------------------------------------------
113+
110114
### NEFSC Bottom Trawl
111115

112116
`nefsc <- pull_nefsc(proj_path = my_path)`
@@ -117,8 +121,8 @@ coordinates based on trip type.
117121
| 1.97003e+12 | 28 | thorny skate | 1970 | 3 | 0 | Spring | 41.58333 | -69.46667 | 3/12/70 8:45 | 0.900 |
118122
| 1.97003e+12 | 73 | atlantic cod | 1970 | 3 | 0 | Spring | 41.58333 | -69.46667 | 3/12/70 8:45 | 8.910 |
119123

120-
**How it works:** The trawl data is received from the Northeast
121-
Fisheries Science Center as a .Rdata file pulled from an SQL database.
124+
**How it works:** The trawl data is received from the **Northeast
125+
Fisheries Science Center** as a .Rdata file pulled from an SQL database.
122126
`survdat` is extracting from the larger list of data and is the basis of
123127
the data used here. `survdat` is combined with a previously built
124128
species list to add the common names of survey species.
@@ -136,6 +140,8 @@ Strata and species not regularly sampled are then filtered out from the
136140
data, and the data subset to begin at 1970, when the trawl began to run
137141
consistently.
138142

143+
------------------------------------------------------------------------
144+
139145
### GARFO Federal Permits
140146

141147
`permits <- pull_permits(proj_path = my_path)`
@@ -146,7 +152,36 @@ consistently.
146152
| 1996 | 227830 | 127133 | GLOUCESTER | MA | lobster_1 | lobster | commercial | 42.61536 | -70.66246 | Massachusetts | New England |
147153
| 1996 | 227831 | 231461 | RYE | NH | lobster_1 | lobster | commercial | 43.01202 | -70.77194 | New Hampshire | New England |
148154

149-
**How it works:**
155+
**How it works:** Federal permits data is received as a series of
156+
individual Excel spreadsheets, one for each year. This function is
157+
designed to read in multiple Excel files from a single source folder and
158+
combine them into one data frame.
159+
160+
Permits are grouped by species, in that each species is represented by a
161+
single column and each permits type represented by a number, letter, or
162+
some combination of both. If an individual holds multiple permits
163+
types/endorsements, a single entry is made and those values are
164+
separated by a comma within a single cell. As such, this function breaks
165+
up each column into the respective number of permits types, and renamed
166+
with the target species name and permit type (ex: `black_sea_bass_1` and
167+
`black_sea_bass_2`). The all permit type columns are then pivoted, so
168+
that each permit application number has a corresponding permit type and
169+
value `1` for that permit.
170+
171+
From there, the names of target species are cleaned and added as a
172+
separate column, for later species-level grouping. An additional column
173+
is added based on whether a permit type is categorized as `commercial`,
174+
`for-hire/charter` or `recreational`. Because we are interested in also
175+
accessing species-level trends, permits that cover multiple species
176+
(`multispecies` and `squid/mackerel/butterfish`) have been parsed out so
177+
that each specific permit type corresponds with it’s target species.
178+
179+
Lastly, permits are geocoded using `tidygeocoder` to their reported
180+
principal port and grouped to their respective management council
181+
region. Roughly 1% of entries are lost due to misspelled principal
182+
ports.
183+
184+
------------------------------------------------------------------------
150185

151186
### GARFO Dealer-reported landings
152187

@@ -158,6 +193,15 @@ consistently.
158193
| 1996 | ADDISON | ME | lobster, american | 355359 | 355359 | 1178910 | NA | american lobster | 44.61882 | -67.74445 | Maine | New England |
159194
| 1996 | ADDISON | ME | scallop, sea | 9704 | 80837 | 66560 | NA | sea scallop | 44.61882 | -67.74445 | Maine | New England |
160195

196+
**How it works:** Confidential landings data was received along with the
197+
vessel trip reports as an Excel spreadsheet. The first 9 lines contained
198+
metadata as provided by **GARFO**. As such, this function uses `readxl`
199+
to read in the file and requires a `skip` argument to skip the first few
200+
rows that contain metadata. `SwimmeR` is used to clean the species names
201+
and `tidygeocoder` to geocode the ports associated with landings.
202+
203+
------------------------------------------------------------------------
204+
161205
### Marine Recreational Information Program
162206

163207
#### Directed trips
@@ -170,6 +214,28 @@ consistently.
170214
| 2018 | 1 | 10 | 5 | 3 | 5 | striped bass | 169377.67 | 40817.095 | 24.1 | DE | Shore | Inland |
171215
| 2018 | 1 | 10 | 5 | 7 | 1 | striped bass | 44944.57 | 38431.208 | 85.5 | DE | Private & Rental | State Territorial Seas (Ocean\<=3 mi excluding Inland) |
172216

217+
**How it works:** The function to pull in and clean the MRIP directed
218+
trips is arguably the most complex of the data cleaning functions. The
219+
data is hosted online and is downloadable as a ZIP file for individual
220+
years. This function pulls in the zipped files, unzips them and saves
221+
them locally in intermediate files, which are required for the trip
222+
estimation code. Once the data has been pulled in and saved to the
223+
intermediary files, the trip estimates are calculated using [Gary
224+
Nelson](https://carlylovas.github.io/species.shifts/articles/gary.nelson@state.ma.us)’s
225+
[MRIP directed trip estimate R
226+
template](https://www.fisheries.noaa.gov/recreational-fishing-data/recreational-fishing-data-downloads).
227+
This code estimates the number of directed trips by species, wave,
228+
domain, trip type and year.
229+
230+
For this analyses, we used all waves, primary target trip type, all
231+
states along the east coast, and calculate estimates for Atlantic
232+
croaker, Atlantic mackerel, black sea bass, blueline tilefish, bluefish,
233+
gray triggerfish, king mackerel, Spanish mackerel, striped bass, summer
234+
flounder, scup, spiny dogfish, goosefish (monkfish) and tilefish (golden
235+
tilefish).
236+
237+
------------------------------------------------------------------------
238+
173239
#### Catch estimates
174240

175241
`mrip_catch <- pull_mrip_catch()`
@@ -180,6 +246,14 @@ consistently.
180246
| Final | 2024 | Atlantic Coast | Mid Atlantic | Delaware | shark, dogfish, spiny | Squalus acanthias | 0 | 0.0 | 0 | 0.0 | 35430 | 6611 | 64249 | 35430 | 6611 | 64249 | 41.5 | spiny dogfish |
181247
| Final | 2024 | Atlantic Coast | Mid Atlantic | Delaware | bass, black sea | Centropristis striata | 105763 | 28.8 | 130995 | 28.1 | 1008441 | 290955 | 1725926 | 1114203 | 395720 | 1832686 | 32.9 | black sea bass |
182248

249+
**How it works:** Catch estimates are publically available on the [ACCSP
250+
Data
251+
Warehouse](https://safis.accsp.org/accsp_prod/f?p=1490:1:1685966511435:::::)
252+
and downloaded as a CSV File. This function reads in the CSV and cleans
253+
the species names to be uniform with other data sets.
254+
255+
------------------------------------------------------------------------
256+
183257
## Plotting
184258

185259
Once the data has been pulled and saved to the local environment, each

articles/scup_demo.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkgdown.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ articles:
77
plotting_functions: plotting_functions.html
88
scup_demo: scup_demo.html
99
summer_flounder_demo: summer_flounder_demo.html
10-
last_built: 2026-06-18T20:35Z
10+
last_built: 2026-06-22T17:44Z
1111
urls:
1212
reference: https://carlylovas.github.io/species.shifts/reference
1313
article: https://carlylovas.github.io/species.shifts/articles

search.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)