#' @title Calculate \code{tfac}, the model temperature factor
#' @description Calculates the model parameter \code{tfac} from monthly temperature data.
#' Expects monthly data for a single-year dataframe; \code{map} over a list of annual dataframes, or
#' use to \code{mutate} a grouped tibble.
#' @param temp Numeric vector of length 12 indicating monthly temperature, in degrees Celsius.
#' @param params A named list containing model parameters. Defaults to the package default parameter
#' set \code{soilc_params}.
#' @export
tfac <- function(temp, params = soilc_params) {
prelim <- (params$tmax$be - temp) / (params$tmax$be - params$topt$be)
t_i <- prelim ^ params$ta$be * exp(0.076 * (1 - prelim ^ params$tb$be))
tfac <- 1 / 12 * sum(t_i)
return(tfac)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.