#' Convert a vector of POSIX dates to null fractional years, i.e. 1-1.99 is the current proc_yr, 0-0.99 is the previous year, >2 is subsequent years.
#' @export
#' @title Convert POSIX dates to null fractional year
#'
#' @param POSIX date vector, POSIX dates in the format: 'YYY-MM-DD'
#' @param proc_yr numeric vector, array of years denoting the current process_year (process_years may include data from other calendar years, but are centered on a particular year)
#' @importFrom lubridate decimal_date
fPOSIX_to_fracyr_null <- function(POSIX, proc_yr) {
POSIX <- as.Date(POSIX, "%Y-%m-%d")
fracyr <- decimal_date(POSIX)
fracyr_null <- fracyr - (proc_yr - 1)
return(fracyr_null)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.