(sub)Daily/Monthly -> Annual
Generic function for transforming a (sub)DAILY/MONTHLY (weekly and quarterly) regular time series into an ANNUAL one.
daily2annual(x, ...) subdaily2annual(x, ...) monthly2annual(x, ...) ## Default S3 method: daily2annual(x, FUN, na.rm = TRUE, out.fmt = "%Y", ...) ## S3 method for class 'zoo' daily2annual(x, FUN, na.rm = TRUE, out.fmt = "%Y-%m-%d", ...) ## S3 method for class 'data.frame' daily2annual(x, FUN, na.rm = TRUE, out.fmt = "%Y", dates=1, date.fmt = "%Y-%m-%d", out.type = "data.frame", verbose = TRUE, ...) ## S3 method for class 'matrix' daily2annual(x, FUN, na.rm = TRUE, out.fmt = "%Y", dates=1, date.fmt = "%Y-%m-%d", out.type = "data.frame", verbose = TRUE, ...)
x |
zoo, xts, data.frame or matrix object, with (sub)daily/monthly time series. |
FUN |
Function that have to be applied for aggregating from (sub)daily/monthly into annual time step (e.g., for precipitation |
na.rm |
Logical. Should missing values be removed? |
out.fmt |
Character indicating the date format for the output time series. See |
dates |
numeric, factor or Date object indicating how to obtain the dates for corresponding to each gauging station |
date.fmt |
character indicating the format in which the dates are stored in dates, e.g. %Y-%m-%d. See |
out.type |
Character that defines the desired type of output. Valid values are: |
verbose |
logical; if TRUE, progress messages are printed |
... |
further arguments passed to or from other methods. |
a zoo object with annual frequency
Mauricio Zambrano-Bigiarini, mzb.devel@gmail
###################### ## Ex1: Loading the DAILY precipitation data at SanMartino data(SanMartinoPPts) x <- SanMartinoPPts ## Daily to Annual daily2annual(x, FUN=sum, na.rm=TRUE) ###################### ## Ex2: Monthly to Annual (same result as ) m <- daily2monthly(x, FUN=sum, na.rm=TRUE) monthly2annual(m, FUN=sum, na.rm=TRUE) ###################### ## Ex3: Loading the time series of HOURLY streamflows for the station Karamea at Gorge data(KarameaAtGorgeQts) x <- KarameaAtGorgeQts # Sub-daily to monthly ts subdaily2annual(x, FUN=mean, na.rm=TRUE) ############ ## Ex4: Loading the monthly time series of precipitation within the Ebro River basin data(EbroPPtsMonthly) # computing the annual values for the first 10 gauging station in 'EbroPPtsMonthly' a <- monthly2annual(EbroPPtsMonthly[,1:11], FUN=sum, dates=1) # same as before, but with a nicer format of years a <- monthly2annual(EbroPPtsMonthly[,1:11], FUN=sum, dates=1, out.fmt="%Y")
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.