Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the get_all_* functions #23

Merged
merged 55 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
e13ccb2
Merge pull request #21 from pbs-assess/master
ecophilina Sep 27, 2024
7d8ea2f
return species code with length types to allow for use with multi spp…
ecophilina Oct 1, 2024
0fd4366
new get_all* functions and all supporting code
ecophilina Oct 1, 2024
ad7f70b
document new functions
ecophilina Oct 1, 2024
5a0522b
untested draft light-weight comparison functions and example script
ecophilina Oct 2, 2024
237d39e
updated with load_all() and subfolders
Oct 3, 2024
7d2a9d4
updated with missing package::
Oct 3, 2024
a5b6e5f
get all vignette
ecophilina Oct 3, 2024
ca97436
fix bug in comparison functions
ecophilina Oct 4, 2024
8e20fd0
vignette edits
ecophilina Oct 4, 2024
280ec3a
fixed precautionary object resets
Oct 4, 2024
48d9382
Merge branch 'get-all' of https://github.com/pbs-assess/gfdata into g…
Oct 4, 2024
72327ed
make remove duplicates the default for get_all_survey_sets
ecophilina Oct 4, 2024
e57f5fa
Merge branch 'get-all' of https://github.com/pbs-assess/gfdata into g…
ecophilina Oct 4, 2024
4f2486a
move the dropping of all zeros and make it optional
ecophilina Oct 4, 2024
9abfd11
Merge branch 'get-all' of https://github.com/pbs-assess/gfdata into g…
ecophilina Oct 4, 2024
aed155a
update default args
ecophilina Oct 4, 2024
6686825
vignette formatting
ecophilina Oct 5, 2024
df134cc
Merge branch 'get-all' of https://github.com/pbs-assess/gfdata into g…
ecophilina Oct 5, 2024
4be41d3
draft version flexible to argument changes
ecophilina Oct 7, 2024
38629ff
working for any argument and using function defaults when not provided
ecophilina Oct 8, 2024
3d6bb4d
and grouping_area_km2 to event data returned for both functions
ecophilina Oct 8, 2024
103a229
functionize area swept calc
ecophilina Oct 8, 2024
c00c50e
minor clean up/style
ecophilina Oct 8, 2024
bdf565b
vignette edits from LR and add design-based section
ecophilina Oct 8, 2024
a395f80
fix error in compare samples function; make both compare functions ro…
ecophilina Oct 9, 2024
69f5e1a
more vignette edits
ecophilina Oct 9, 2024
bba0c2b
better way of checking for gear type differences
ecophilina Oct 9, 2024
8414bb1
more vignette edits
ecophilina Oct 9, 2024
f4b241a
minor vignette and comparison edits
ecophilina Oct 9, 2024
be6886e
more minor edits
ecophilina Oct 9, 2024
da29503
more vignette edits
ecophilina Oct 9, 2024
2e82a68
fix problem with missing sublevel data for ssid 14--now only gets sub…
ecophilina Oct 10, 2024
8ed7771
update vignette to match change in when skate level data is returned
ecophilina Oct 10, 2024
b10bce3
add warning in case situations arise where skate-level counts are inc…
ecophilina Oct 10, 2024
8087c27
minor fixes to last change
ecophilina Oct 10, 2024
fe4fdeb
for samples, add checks to make sure counts are coming in currectly w…
ecophilina Oct 10, 2024
2286148
more vignette edits
ecophilina Oct 10, 2024
458326f
fix for edge case of missing sub level id for some gear comparision s…
ecophilina Oct 10, 2024
44e1723
tiny edit
ecophilina Oct 10, 2024
1befbe7
Improve messages to include the filtering options used.
ecophilina Oct 10, 2024
ca90779
document and fixes for passing devtools::check
ecophilina Oct 10, 2024
baefe64
better message placement; filter ssid 0 when a duplication of data fr…
ecophilina Oct 11, 2024
4e18062
Merge branch 'get-all' of https://github.com/pbs-assess/gfdata into g…
ecophilina Oct 11, 2024
e9836af
minor vignette edits
ecophilina Oct 11, 2024
ec13dd2
Merge branch 'get-all' of https://github.com/pbs-assess/gfdata into g…
ecophilina Oct 11, 2024
ed51119
more minor edits
ecophilina Oct 11, 2024
85a811e
fixing vignette check issues
ecophilina Oct 11, 2024
0df2af1
precompile option for get-all vignette
ecophilina Oct 12, 2024
b8cbf29
update ignore and precompiled version
ecophilina Oct 12, 2024
d46a2db
test commit
ecophilina Oct 12, 2024
40f36cd
implement precompile option for orginal vignette
ecophilina Oct 15, 2024
18f8546
document
ecophilina Oct 15, 2024
0c03869
Merge branch 'get-all' of https://github.com/pbs-assess/gfdata into g…
ecophilina Oct 15, 2024
b605a73
buildignore knitr-cache
ecophilina Oct 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
^NEWS\.md$
^\.github$
^data-raw$
^vignettes/get-all-cache
^vignettes/knitr-cache
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Imports:
tibble,
tidyr,
rlang
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
Suggests:
usethis,
testthat,
Expand Down
6 changes: 6 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export(get_active_survey_blocks)
export(get_age_methods)
export(get_age_precision)
export(get_all_stomachs)
export(get_all_survey_samples)
export(get_all_survey_sets)
export(get_catch)
export(get_catch_spatial)
export(get_comm_gear_types)
Expand Down Expand Up @@ -58,6 +60,7 @@ importFrom(dplyr,as_tibble)
importFrom(dplyr,bind_rows)
importFrom(dplyr,case_when)
importFrom(dplyr,contains)
importFrom(dplyr,distinct)
importFrom(dplyr,filter)
importFrom(dplyr,full_join)
importFrom(dplyr,group_by)
Expand All @@ -66,12 +69,15 @@ importFrom(dplyr,left_join)
importFrom(dplyr,mutate)
importFrom(dplyr,n)
importFrom(dplyr,pull)
importFrom(dplyr,relocate)
importFrom(dplyr,rename)
importFrom(dplyr,right_join)
importFrom(dplyr,select)
importFrom(dplyr,semi_join)
importFrom(dplyr,summarise)
importFrom(dplyr,tibble)
importFrom(dplyr,ungroup)
importFrom(dplyr,where)
importFrom(magrittr,"%>%")
importFrom(rlang,.data)
importFrom(stats,na.omit)
35 changes: 35 additions & 0 deletions R/correct-ssids.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#' Custom fixes for problem surveys with shared trip ids resulting in assignment to wrong ssid
#'
#' @param dat df containing these columns: fishing_event_ids, survey_series_id, survey_id,
#' major_stat_area_code, minor_stat_area_code
#' @param specimens Defaults to FALSE where checks for duplication of fishing_event_ids
#'
correct_ssids <- function(dat, specimens = FALSE) {
try(dat[dat$survey_series_id %in% c(6, 7), ]$survey_id <- NA, silent = TRUE)
try(dat[((dat$survey_series_id == 6 & dat$major_stat_area_code %in% c("03", "04"))), ]$survey_series_id <- 7, silent = TRUE)
try(dat[((dat$survey_series_id == 7 & dat$major_stat_area_code %in% c("05", "06"))), ]$survey_series_id <- 6, silent = TRUE)
try(dat[((dat$survey_series_og == 6 & dat$major_stat_area_code %in% c("03", "04"))), ]$survey_series_og <- 7, silent = TRUE)
try(dat[((dat$survey_series_og == 7 & dat$major_stat_area_code %in% c("05", "06"))), ]$survey_series_og <- 6, silent = TRUE)

# SABLE doesn't work with SSIDs, use reason_desc and or grouping codes instead?
try(dat[dat$survey_series_id %in% c(35, 41, 42, 43), ]$survey_id <- NA, silent = TRUE) # this throws a warning when others don't
try(dat[dat$survey_series_id %in% c(35, 41, 42, 43), ]$survey_series_id <- 35, silent = TRUE)
try(dat[dat$survey_series_og %in% c(35, 41, 42, 43), ]$survey_series_og <- 35, silent = TRUE)
# try(dat[ ((dat$survey_series_id %in% c(35, 41, 42, 43) & dat$reason_desc == "EXPLORATORY")), ]$survey_series_id <- 35, silent = TRUE)
# try(dat[ ((dat$survey_series_id %in% c(35, 41, 42, 43) & dat$reason_desc == "SABLEFISH STANDARDIZED OFFSHORE SURVEY")), ]$survey_series_id <- 42, silent = TRUE)

# Jig surveys are split into too many separate survey series, so we'll assume all were assigned correctly and drop everything that doesn't match
dat <- dat[(!(dat$survey_series_id == 82 & !(dat$minor_stat_area_code %in% c("12")))), ]
dat <- dat[(!(dat$survey_series_id == 83 & !(dat$minor_stat_area_code %in% c("13")))), ]
dat <- dat[(!(dat$survey_series_id == 84 & !(dat$minor_stat_area_code %in% c("15")))), ]
dat <- dat[(!(dat$survey_series_id == 85 & !(dat$minor_stat_area_code %in% c("16")))), ]
dat <- dat[(!(dat$survey_series_id == 86 & !(dat$minor_stat_area_code %in% c("18")))), ]
dat <- dat[(!(dat$survey_series_id == 87 & !(dat$minor_stat_area_code %in% c("19")))), ]

# for IPHC station specific ssids, drop everything that doesn't match
dat <- dat[(!(dat$survey_series_id == 17 & !(dat$minor_stat_area_code %in% c("3")))), ] # 3CD
dat <- dat[(!(dat$survey_series_id == 18 & !(dat$minor_stat_area_code %in% c("6")))), ] # 5AB
dat <- dat[(!(dat$survey_series_id == 19 & !(dat$minor_stat_area_code %in% c("7")))), ] # 5CD

dat |> dplyr::distinct()
}
Loading
Loading