|
| 1 | +#' @title |
| 2 | +#' Adjust Sourdough Recipe Fermentation and Proofing Times Based on Temperature |
| 3 | +#' |
| 4 | +#' @description |
| 5 | +#' Adjust sourdough recipe fermentation and proofing times based on temperature. |
| 6 | +#' |
| 7 | +#' @details |
| 8 | +#' Adjusts sourdough recipe fermentation and proofing times based on ambient |
| 9 | +#' temperature. Suggested times are calculated using the \eqn{Q_{10}} |
| 10 | +#' temperature coefficient, which describes how the rate of fermentation changes |
| 11 | +#' with a 10°C temperature difference. |
| 12 | +#' |
| 13 | +#' @param original_time The original time(s) specified in the original recipe. |
| 14 | +#' @param recipe_temp The intended ambient temperature in the original recipe. |
| 15 | +#' @param actual_temp The actual ambient temperature used. |
| 16 | +#' @param q10 The \eqn{Q_{10}} temperature coefficient (describes rate change |
| 17 | +#' per 10°C). |
| 18 | +#' @param temp_unit "F" for Fahrenheit; "C" for Celsius. |
| 19 | +#' |
| 20 | +#' @return The adjusted sourdough fermentation or proofing time(s). |
| 21 | +#' |
| 22 | +#' @family baking |
| 23 | +#' |
| 24 | +#' @export |
| 25 | +#' |
| 26 | +#' @examples |
| 27 | +#' adjust_sourdough_time( |
| 28 | +#' original_time = c(12, 15, 18), |
| 29 | +#' recipe_temp = 70, |
| 30 | +#' actual_temp = 75 |
| 31 | +#' ) |
| 32 | +#' |
| 33 | +#' @seealso |
| 34 | +#' \url{https://en.wikipedia.org/wiki/Q10_(temperature_coefficient)} |
| 35 | + |
| 36 | +adjust_sourdough_time <- function( |
| 37 | + original_time, |
| 38 | + recipe_temp, |
| 39 | + actual_temp, |
| 40 | + q10 = 2, |
| 41 | + temp_unit = c("F","C")) { |
| 42 | + |
| 43 | + # Match argument for temperature unit |
| 44 | + temp_unit <- match.arg(temp_unit) |
| 45 | + |
| 46 | + # Convert to Celsius if input is in Fahrenheit |
| 47 | + if (temp_unit == "F") { |
| 48 | + recipe_temp <- (recipe_temp - 32) * 5 / 9 |
| 49 | + actual_temp <- (actual_temp - 32) * 5 / 9 |
| 50 | + } |
| 51 | + |
| 52 | + # Calculate the adjustment factor |
| 53 | + adjustment_factor <- q10 ^ ((recipe_temp - actual_temp) / 10) |
| 54 | + |
| 55 | + # Return the new time |
| 56 | + new_time <- original_time * adjustment_factor |
| 57 | + |
| 58 | + return(new_time) |
| 59 | +} |
0 commit comments