# yearmon

From chron v2.3-18
by Kurt Hornik

##### Convert monthly or quarterly data to chron

These functions can be used to convert the times of `"ts"`

series
with `frequency`

of 12 or 4 or objects of `"yearmon"`

and
`"yearqtr"`

class, as defined in the `chron`

dates.

- Keywords
- ts

##### Usage

```
## S3 method for class 'yearmon':
as.chron(x, frac = 0, holidays = FALSE, ...)
## S3 method for class 'yearqtr':
as.chron(x, frac = 0, holidays = FALSE, ...)
## S3 method for class 'ts':
as.chron(x, frac = 0, holidays = FALSE, ...)
```

##### Arguments

- x
- an object of class
`"yearmon"`

or`"yearqtr"`

or`"ts"`

objects, or a numeric vector interpreted - frac
- Number between zero and one inclusive representing the fraction of the way through the month or quarter.
- holidays
- If
`TRUE`

or a vector of chron dates, indicated holidays and weekends are excluded so the return value will be a non-holiday weekday. - ...
- Other arguments passed to
`chron`

.

##### Details

The `"yearmon"`

and `"yearqtr"`

classes are defined in
package `holidays`

is `TRUE`

or a vector of
dates then the `is.holiday`

function is used to determine whether
days are holidays.

The method for ts objects converts the times corresponding to
`time(x)`

to chron. The ts series must have a frequency that is
a divisor of 12.

##### Value

- Returns a
`chron`

object.

##### See Also

##### Examples

```
## Monthly time series data.
as.chron(AirPassengers)
as.chron(time(AirPassengers))
## convert to first day of the month that is not a weekend or holiday
as.chron(AirPassengers, frac = 0, holidays = TRUE)
## convert to last day of the month
as.chron(AirPassengers, frac = 1)
## convert to last day of the month that is not a weekend or holiday
as.chron(AirPassengers, frac = 1, holidays = TRUE)
## convert to last weekday of the month
as.chron(AirPassengers, frac = 1, holidays = c())
## Quarterly time series data.
as.chron(presidents)
as.chron(time(presidents))
```

*Documentation reproduced from package chron, version 2.3-18, License: GPL-2*

### Community examples

Looks like there are no examples yet.