Skip to content

Commit

Permalink
change fit_mat_ogive function to use sample_date preferentially over …
Browse files Browse the repository at this point in the history
…trip_start_date to generate month when month is missing from a data frame
  • Loading branch information
ecophilina committed Oct 8, 2024
1 parent 5989da8 commit 96fda8c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion R/maturity.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ fit_mat_ogive <- function(dat,
link <- match.arg(link)

if(!("month" %in% names(dat))){
dat <- mutate(dat, month = lubridate::month(trip_start_date))
if(("sample_date" %in% names(dat))){
dat <- mutate(dat, month = lubridate::month(sample_date))
} else {
dat <- mutate(dat, month = lubridate::month(trip_start_date))
print("Assigned a month using trip start dates rather than sample dates.")
}
}

dat <- dat %>% filter(maturity_convention_code != 9)
Expand Down

0 comments on commit 96fda8c

Please sign in to comment.