Description Usage Arguments Author(s) See Also Examples
View source: R/daily2monthly.R
Generic function for transforming a DAILY (sub-daily or weekly) regular time series into a MONTHLY one
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | daily2monthly(x, ...)
subdaily2monthly(x, ...)
## Default S3 method:
daily2monthly(x, FUN, na.rm = TRUE, ...)
## S3 method for class 'zoo'
daily2monthly(x, FUN, na.rm = TRUE, ...)
## S3 method for class 'data.frame'
daily2monthly(x, FUN, na.rm = TRUE, dates=1, date.fmt = "%Y-%m-%d",
out.type = "data.frame", out.fmt="numeric", verbose = TRUE, ...)
## S3 method for class 'matrix'
daily2monthly(x, FUN, na.rm = TRUE, dates=1, date.fmt = "%Y-%m-%d",
out.type = "data.frame", out.fmt="numeric", verbose = TRUE, ...)
|
x |
zoo, xts, data.frame or matrix object, with daily/monthly time series. |
FUN |
Function that have to be applied for transforming from daily to annual time step. (e.g., for precipitation |
na.rm |
Logical. Should missing values be removed? |
dates |
numeric, factor or Date object indicating how to obtain the dates for 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: |
out.fmt |
OPTIONAL. Only used when |
verbose |
logical; if TRUE, progress messages are printed |
... |
further arguments passed to or from other methods. |
Mauricio Zambrano-Bigiarini, mzb.devel@gmail
daily2annual
, subdaily2daily
, monthlyfunction
, hydroplot
, vector2zoo
, izoo2rzoo
, as.Date
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ######################
## Ex1: Loading the DAILY precipitation data at SanMartino
data(SanMartinoPPts)
x <- SanMartinoPPts
## Daily to monthly
m <- daily2monthly(x, FUN=sum, na.rm=TRUE)
######################
## Ex2: Loading the time series of HOURLY streamflows for the station Karamea at Gorge
data(KarameaAtGorgeQts)
x <- KarameaAtGorgeQts
# Sub-daily to monthly ts
subdaily2monthly(x, FUN=mean, na.rm=TRUE)
|
Loading required package: zoo
Attaching package: 'zoo'
The following objects are masked from 'package:base':
as.Date, as.Date.numeric
Loading required package: xts
1980-01-01 1980-02-01 1980-03-01 1980-04-01 1980-05-01 1980-06-01 1980-07-01
193.48101 124.59784 111.72742 96.15687 170.14073 93.39875 87.06478
1980-08-01 1980-09-01 1980-10-01 1980-11-01 1980-12-01 1981-01-01 1981-02-01
221.00390 303.89805 131.88871 177.14708 67.89597 31.45538 55.75491
1981-03-01 1981-04-01 1981-05-01 1981-06-01 1981-07-01 1981-08-01 1981-09-01
52.19208 91.63181 111.87083 121.66319 191.75914 86.65860 246.17775
1981-10-01 1981-11-01 1981-12-01 1982-01-01 1982-02-01 1982-03-01 1982-04-01
172.18696 144.67986 130.62594 109.69355 82.35387 44.03114 37.67403
1982-05-01 1982-06-01 1982-07-01 1982-08-01 1982-09-01 1982-10-01 1982-11-01
180.64543 97.25056 124.67661 129.30094 163.63686 88.76411 183.51375
1982-12-01 1983-01-01 1983-02-01 1983-03-01 1983-04-01 1983-05-01 1983-06-01
203.08522 169.69261 55.97187 106.25866 183.41042 259.11532 126.82847
1983-07-01 1983-08-01 1983-09-01 1983-10-01 1983-11-01 1983-12-01 1984-01-01
118.27957 88.98347 170.80515 164.64758 101.03653 95.98454 59.49462
1984-02-01 1984-03-01 1984-04-01 1984-05-01 1984-06-01 1984-07-01 1984-08-01
34.18764 45.79893 89.62528 98.47554 95.05014 146.89059 162.90618
1984-09-01 1984-10-01 1984-11-01 1984-12-01 1985-01-01 1985-02-01 1985-03-01
82.85535 203.88938 72.95866 90.95488 134.55726 52.02158 30.67732
1985-04-01 1985-05-01 1985-06-01 1985-07-01 1985-08-01 1985-09-01 1985-10-01
86.66139 41.30780 81.62736 107.78078 88.77110 129.94325 64.47742
1985-11-01 1985-12-01
106.80361 153.62654
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.