Skip to content

Commit

Permalink
Merge pull request #46 from pfmc-assessments/style-doc-code
Browse files Browse the repository at this point in the history
Style code and document
  • Loading branch information
chantelwetzel-noaa authored Jan 14, 2025
2 parents 8f380fe + 1fca4aa commit b1f1b89
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
1 change: 0 additions & 1 deletion data-raw/configuration.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,3 @@ best <- data |>
# it is class(data) > [1] "tbl_df" "tbl" "data.frame"
# * for vessel_year, might want a different level scaling things might not have
# to give this to grid

20 changes: 10 additions & 10 deletions data-raw/configuration_yellowtail.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ data <- configuration |>
latitude >= min_latitude, latitude <= max_latitude,
year >= min_year, year <= max_year
) |>
dplyr::mutate(split_mendocino = ifelse(latitude > 40.1666667, "N", "S")))
dplyr::mutate(split_mendocino = ifelse(latitude > 40.1666667, "N", "S")))
) |>
dplyr::ungroup()

Expand All @@ -36,12 +36,16 @@ dplyr::filter(data$data_filtered[[1]], catch_weight > 0) |>
dplyr::summarise(n = dplyr::n())

# Find variables that aren't identifiable for presence-absence model
lm <- lm(formula = as.formula(configuration$formula),
data = data$data_filtered[[1]])
#not_identifiable <- names(which(is.na(coef(lm))))
lm <- lm(
formula = as.formula(configuration$formula),
data = data$data_filtered[[1]]
)
# not_identifiable <- names(which(is.na(coef(lm))))
# Find variables that aren't identifiable for positive model
lm_pos <- lm(formula = as.formula(configuration$formula),
data = dplyr::filter(data$data_filtered[[1]], catch_weight>0))
lm_pos <- lm(
formula = as.formula(configuration$formula),
data = dplyr::filter(data$data_filtered[[1]], catch_weight > 0)
)
pos_not_identifiable <- names(which(is.na(coef(lm_pos))))

# Create variables to be not estimated/ mapped off
Expand Down Expand Up @@ -77,7 +81,3 @@ best <- data |>
.f = indexwc::run_sdmtmb
)
)




8 changes: 4 additions & 4 deletions data-raw/grid_nwfscSurvey.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ california_current_grid <- california_current_grid |>
pass_scaled = 0,
vessel_year = 0,
region = 0,
split_mendocino = dplyr::case_when(Lat > 40.1666667 ~"N", .default = "S"),
split_conception = dplyr::case_when(Lat > 34.45 ~"N", .default = "S"),
split_monterey = dplyr::case_when(Lat > 36.0 ~"N", .default = "S"),
split_state = dplyr::case_when(Lat > 46.25 ~"W", Lat < 42.0 ~"C", .default = "O"),
split_mendocino = dplyr::case_when(Lat > 40.1666667 ~ "N", .default = "S"),
split_conception = dplyr::case_when(Lat > 34.45 ~ "N", .default = "S"),
split_monterey = dplyr::case_when(Lat > 36.0 ~ "N", .default = "S"),
split_state = dplyr::case_when(Lat > 46.25 ~ "W", Lat < 42.0 ~ "C", .default = "O"),
propInTriennial = ifelse(Lat < 34.5, 0, propInTriennial),
depth = Depth_km * -1000,
dplyr::across(
Expand Down
2 changes: 1 addition & 1 deletion man/run_sdmtmb.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b1f1b89

Please sign in to comment.