hm_subset {hydrotoolbox} | R Documentation |
Subset your data by dates
Description
The method will subset the required slot.
Usage
hm_subset(obj, slot_name = "all", from = NULL, to = NULL)
## S4 method for signature 'hydromet_station'
hm_subset(obj, slot_name = "all", from = NULL, to = NULL)
## S4 method for signature 'hydromet_compact'
hm_subset(obj, slot_name = "all", from = NULL, to = NULL)
Arguments
obj |
a valid |
slot_name |
string vector with the name(s) of the slot(s) to subset. If you use 'all' as argument the method will subset all the variables with data. |
from |
string |
to |
string |
Value
The same hydromet_XXX
class object provided in obj
but subsetted.
Functions
-
hm_subset(hydromet_station)
: subset method for station class -
hm_subset(hydromet_compact)
: subset method for compact class
Examples
## Not run:
# cuevas station
path <- system.file('extdata', package = 'hydrotoolbox')
# use the build method
hm_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)' )
)
# subset relative humidity and plot it
hm_subset(obj = hm_cuevas, slot_name = 'rh',
from = ISOdate(2020, 2, 1),
to = ISOdate(2020, 4, 1) ) %>%
hm_plot(slot_name = 'rh',
col_name = list('rh(%)'),
interactive = TRUE,
y_lab = 'RH(%)' )
## End(Not run)
[Package hydrotoolbox version 1.1.2 Index]