shiftyears: Shiftyears

View source: R/shiftyears.R

shiftyearsR Documentation

Shiftyears

Description

It shifts years backwards for correct computation of annual values when the hydrological year does not start in january. Originally created only for internal usage in this pacakge.

Usage

shiftyears(ltime, lstart.month)

Arguments

ltime

vector with the date/times of each element of a zoo object.

lstart.month

numeric in [1,..,12], representing the starting month to be used in the computation of annual values. By default lstart.month=1 (Jan).

Value

Integer vector with the shifted years corresponding to each elemen of x.

Author(s)

Mauricio Zambrano-Bigiarini, mzb.devel@gmail

See Also

climograph, cmv, daily2annual

Examples

# Loading the DAILY precipitation data at SanMartino
data(SanMartinoPPts)
x <- SanMartinoPPts

# Subsetting 'x' to its first three months (Jan/1921 - Mar/1921)
x <- window(x, end="1921-12-31")

# Starting in January, it means no shift
shiftyears(ltime=time(x), lstart.month=1)

# Starting in April:
shiftyears(ltime=time(x), lstart.month=4)

hydroTSM documentation built on April 28, 2026, 9:07 a.m.