#* GENERATE TEMPERATURE SEQUENCE
#'
#' Generate a random temperature sequence
#'
#' Generates a random temperature sequence of a given length between two values and considering sampling error
#'
#' @param Tmin Mimumum temperature value
#'
#' @param Tmax Maximum temperature value
#'
#' @param Nt Number of samples to be taken
#'
#' @param Error Amount of error to be introduced
#'
#' @return A vector of temperature values
#'
#' @examples
#'
#' example <- gen_tmseq(Tmin = 25, Tmax = 30, Nt = 30, Error = 1)
#'
#' plot(example, type = "l", lwd = 1.25, col = "red")
#'
#' @export
gen_tmseq <- function(Tmin, Tmax, Nt, Error){
# define sequence of mean temperatures
mean_ts <- seq(Tmin, Tmax, by = ((Tmax - Tmin)/Nt))
# vector of empty temperautres to fill later
tm <- rep(NA, length(mean_ts))
# loop to sample random temperatures
for(i in 1:length(tm)){tm[i] <- rnorm(1, mean = mean_ts[i], sd = Error)}
# define the return
return(tm)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.