date2yp {bimets}R Documentation

Date to Year-Period Conversion

Description

This function converts an object of class Date() to an array c(YEAR,PERIOD), where YEAR and PERIOD are the year-period the input Date() belongs to, given an input frequency.

Usage

date2yp(x = NULL, f = 1)

Arguments

x

Input of class Date().

f

Positive integer. Valid values are: 1, 2, 3, 4, 12, 24, 36, 53, 366

Value

This function returns a two-dimensional array c(YEAR,PERIOD).

See Also

yq2yp
ym2yp
GETDATE
INTS
TABIT

Examples

	
print(date2yp(as.Date('2001/06/30'),2)) #2001,1
print(date2yp(as.Date('2002/03/23'),1)) #2002,1
print(date2yp(as.Date('2003/07/01'),366)) #2003,182
print(date2yp(as.Date('2004/09/13'),2)) #2004,2
print(date2yp(as.Date('2004/01/13'),12)) #2004,1	
print(date2yp(as.Date('2004/07/24'),4)) #2004,3
print(date2yp(c(as.Date('1900-01-01'),as.Date('1944-12-01'),
as.Date('1964-06-12'),as.Date('1923-03-01'),
as.Date('1943-12-05')),f=366)) #...

[Package bimets version 1.5.3 Index]