dm2seasonal | R Documentation |
Generic function for computing a seasonal value for every year of a sub-daily/daily/weekly/monthly time series
dm2seasonal(x, ...)
subdaily2seasonal(x, ...)
## Default S3 method:
dm2seasonal(x, season, FUN, na.rm = TRUE, out.fmt="%Y", ...)
## S3 method for class 'zoo'
dm2seasonal(x, season, FUN, na.rm = TRUE, out.fmt="%Y", ...)
## S3 method for class 'data.frame'
dm2seasonal(x, season, FUN, na.rm = TRUE, dates=1, date.fmt = "%Y-%m-%d",
out.type = "data.frame", out.fmt="%Y", ...)
## S3 method for class 'matrix'
dm2seasonal(x, season, FUN, na.rm = TRUE, dates=1, date.fmt = "%Y-%m-%d",
out.type = "data.frame", out.fmt="%Y", ...)
x |
zoo, xts, data.frame or matrix object, with sub-daily, daily, weekly or monthly time series. |
season |
character, indicating the weather season to be used for selecting the data. Valid values are: |
FUN |
Function that will be applied to ALL the values of |
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. |
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: |
... |
further arguments passed to or from other methods. |
A numeric vector with the seasonal values for all the years in which x
is defined.
For any year, the FUN
value for the winter season (DJF), is computed considering only January and February, and the value of December is used for computing the winter value of the next year.
FUN
is applied to all the values of x
belonging to the selected season, so the results of this function depends on the frequency sampling of x
and the type of function given by FUN
Mauricio Zambrano-Bigiarini, mzb.devel@gmail
, hydroplot
, seasonalfunction
, time2season
, extract
, daily2monthly
, daily2annual
, monthly2annual
############
## Loading the DAILY precipitation data at SanMartino
data(SanMartinoPPts)
x <- SanMartinoPPts
## Winter (DJF) values of precipitation for each year of 'x'
dm2seasonal(x, FUN=sum, season="DJF")
############
## Loading the HOURLY discharge data for the Karamea at Gorge streamgauge station
data(KarameaAtGorgeQts)
x <- KarameaAtGorgeQts
## Mean winter (DJF) values of streamflow for each year of 'x'
dm2seasonal(x, FUN=mean, season="DJF")
subdaily2seasonal(x, FUN=mean, season="DJF") # same as above
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.