Learn R Programming

season (version 0.2-6)

invyrfraction: Inverse fraction of the year

Description

Inverts a fraction of the year to a date variable or month fraction.

Usage

invyrfraction(frac, type="daily", text=TRUE)

Arguments

frac
a vector of fractions of the year, all between 0 and 1.
type
daily for dates, or monthly for months.
text
add an explanatory text to the returned value (TRUE) or return a number (FALSE).

Value

  • daymdate (day and month for daily) or fractional month (for monthly).

Details

Returns the day and month (for daily) or fraction of the month (for monthly) given a fraction of the year. Assumes a year length of 365.25 days for daily. When using monthly the 1st of January is 1, the 1st of December is 12, and the 31st of December is 12.9.

Examples

Run this code
invyrfraction(c(0,0.5,0.99), type='daily')
invyrfraction(c(0,0.5,0.99), type='monthly')

Run the code above in your browser using DataLab