compute_day_from_date: Convert date into day number

View source: R/compute_day_number.R

compute_day_from_dateR Documentation

Convert date into day number

Description

Computes the day number corresponding to a given date (or vector of) from the first day of a start year. Typically, the start year should be the year of a STICS simulation start. Leap years are properly handled.

Usage

compute_day_from_date(
  date,
  start_year = NULL,
  start_date = lifecycle::deprecated()
)

Arguments

date

date(s) vector to be converted, in the character format ("YYYY-MM-DD") or Date format

start_year

year to be used as time reference (simulation start year). Optional.

start_date

[Deprecated] start_date is no longer supported, use start_year instead.

Value

numeric vector

Author(s)

Timothee Flutre

Examples


date <- as.Date("2015-02-10")
compute_day_from_date(date = date)

compute_day_from_date(date = "2015-02-10", start_year = 2014)

date <- as.Date("2009-02-10")
compute_day_from_date(date = date, start_year = 2008 )

dates <- c(as.Date("2008-02-10"), as.Date("2009-02-10"))
compute_day_from_date(date = dates, start_year = 2008 )


SticsRFiles documentation built on Sept. 12, 2024, 7:41 a.m.