Skip to content

Commit c827359

Browse files
committed
Added flag for noncontiguous samples. Should check output to make sure it still plots with NAs
1 parent 312729f commit c827359

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

MultisppRec2024.Rmd

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -539,11 +539,15 @@ calc_rec <- function(survdat,
539539
COMNAME, SCINAME)
540540
}
541541
} %>%
542-
dplyr::mutate(recruits_biom_lead1 = dplyr::lead(recruits_biom,
542+
dplyr::mutate(bad_pair = !is.na(lead(YEAR)) &
543+
((YEAR +1 != lead(YEAR)) | (SEASON != lead(SEASON))),
544+
recruits_biom_lead1 = dplyr::lead(recruits_biom,
543545
n = 1),
544546
recruits_abund_lead1 = dplyr::lead(recruits_abund,
545-
n = 1),
546-
rs = recruits_abund_lead1/
547+
n = 1)) %>%
548+
dplyr::mutate(across(c(recruits_biom_lead1, recruits_abund_lead1),
549+
~ ifelse(bad_pair, NA, .))) %>%
550+
dplyr::mutate(rs = recruits_abund_lead1/
547551
spawners_biom,
548552
rs_abund = recruits_abund_lead1/
549553
spawners_abund,

0 commit comments

Comments
 (0)