slot_name: string with the name of the slot to aggregate.
col_name: string with column(s) name(s) to aggregate.
fun: string with supported aggregation function name (one per col_name ): mean , min , max , sum , last or first .
period: string with the aggregation time-step: hourly , daily , monthly , annually or climatic . NOTE 1 : the climatic option returns the all series annual statistics (fun ). NOTE 2 : when using annually as period , the method will return the starting dates in the first slot column.
out_name: string with the output column(s) name(s). Default values coerce the original name plus the fun argument (e.g.: tair_max).
allow_na: optional. Numeric value with the maximum allowed number of NA_real_
values. By default the function will not tolerate any NA_real_ (and will return NA_real_ instead).
start_month: optional. Numeric value defining the first month of the annual period (it just make sense if period is either annually or climatic ). Default sets to 1 (January). NOTE : keep in mind that if you choose climatic as period you have to round off a complete year (e.g.: ..., start_month = 6, end_month = 5, ...)
end_month: optional. Numeric value defining the last month of the annual period (it just make sense if period is either annually or climatic ). Default sets to 12 (December). NOTE : keep in mind that if you choose climatic as period you have to round off a complete year (e.g.: ..., start_month = 6, end_month = 5, ...)
relocate: optional. String with the name of the slot where to allocate the aggregated table. It only make sense for hydromet_station class. When using it you must keep in mind that all aggregated series are allocated in a single slot.
Returns
A data frame with the Date and the aggregated variable(s) inside the specified slot.
Functions
hm_agg(hydromet_station): temporal aggregation method for station class
hm_agg(hydromet_compact): temporal aggregation method for compact class
Examples
## Not run:# cuevas stationpath <- system.file('extdata', package ='hydrotoolbox')# use the build methodhm_cuevas <- hm_create()%>% hm_build(bureau ='ianigla', path = path, file_name ='ianigla_cuevas.csv', slot_name = c('tair','rh','patm','precip','wspd','wdir','kin','hsnow','tsoil'), by ='hour', out_name = c('tair(°C)','rh(%)','patm(mbar)','p(mm)','wspd(km/hr)','wdir(°)','kin(kW/m2)','hsnow(cm)','tsoil(°C)'))# aggregate air temperature data to mean valuehm_agg(obj = hm_cuevas, slot_name ='tair', col_name ='tair(°C)', fun ='mean', period ='daily', out_name ='t_mean')%>% hm_show(slot_name ='tair')# the previous command overwrites the original slot, so now we are going# to relocate the agg valueshm_agg(obj = hm_cuevas, slot_name ='tair', col_name ='tair(°C)', fun ='mean', period ='daily', relocate ='tmean', out_name ='tmean(°C)',)%>% hm_show(slot_name ='tmean')## End(Not run)