Learn R Programming

uroot (version 1.3)

ysooys: Search for the date of an observation and vice versa

Description

This function provides the year and season of an observation and the position of an observation in a given date.

Usage

ysooys (yso, t0, N, s)

Arguments

yso
the date or position desired to convert into the date or position. See details.
t0
year and season of the first observation in the observed time series.
N
length of the observed time series.
s
periodicity of the observed time series.

Value

  • A list object that consist of the date or position of an observation, out, and a matrix that relates each date with each position in the sample, index.

Details

If it is desired to search for the date of an observation, the argument yso must be a numeric vector of length one with the position in the sample of the observation.

If it is desired to search for the position of an observation related to a given date (year and season), the argument yso must be a numeric vector of length two containing the year and season of the observation.

Examples

Run this code
## Given an observed monthly time series that starts in 1990.1 and is of length 120:
     # Which is the position of the data observed in 1991.11?
     obs <- ysooys(yso=c(1991,11), t0=c(1990,1), N=120, s=12)$out
     # Which is the date of the 23rd observation?
     ys <- ysooys(yso=23, t0=c(1990,1), N=120, s=12)$out

Run the code above in your browser using DataLab