-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Minor suggestion to streamline code in the future.
When fitting the hurdle models starting in
# Fit the global hurdle models |
You repeat these models and could write a function instead:
Glob.Hurd.Aeae <- pscl::hurdle(
Aeae ~ Precip + TMean + nightlight + Elevation | Precip + TMean + nightlight + Elevation,
data = HCM_Full_Aeae,
dist = "negbin"
)
you can transform that to;
hurdle_wrapper_fx <- function(.data, .response) {
model_obj <- pscl::hurdle(
.response ~ Precip + TMean + nightlight + Elevation | Precip + TMean + nightlight + Elevation,
data = .data,
dist = "negbin"
)
# you could add any formatting here if you wanted to make easier tables later
return(model_obj)
}
Just a suggestion for future reference
Metadata
Metadata
Assignees
Labels
No labels