head.uts: Return the First or Last Part

Description Usage Arguments Note See Also Examples

View source: R/head_tail.R

Description

Return a subperiod time series with the first or last part. The length of the output is specified in terms of the number of observations.

Usage

1
2
3
4
5
## S3 method for class 'uts'
head(x, n = 6L, ...)

## S3 method for class 'uts'
tail(x, n = 6L, ...)

Arguments

x

a "uts" object.

n

a single integer. If positive, length of the the resulting time series. If negative, all but the n last/first number of observations of x.

...

further arguments passed to or from methods.

Note

For an evenly spaced time series, the methods head() and head_t() (or tail() and tail_t()) essentially work the same. For unevenly spaced time series, however, they are quite different. The subperiod window of the former is determined by the observation values, while for the latter it is determined by the observation times.

See Also

head_t, tail_t, window for other methods that extract a subperiod time series.

Examples

1
2
3
4
5
6
head(ex_uts(), 2)
head(ex_uts(), -2)
head(ex_uts(), -6)
tail(ex_uts(), 1)
tail(ex_uts(), -1)
tail(ex_uts(), -6)

andreas50/uts documentation built on April 8, 2021, 10:03 a.m.