subset_hydroMet {hydroToolkit} | R Documentation |
Subset your data
Description
This method allows you to easily cut the data stored in an hydroMet_XXX
class object by dates.
Usage
subset_hydroMet(obj, slot_name, from = NULL, to = NULL)
## S4 method for signature 'hydroMet_BDHI'
subset_hydroMet(obj, slot_name, from = NULL, to = NULL)
## S4 method for signature 'hydroMet_DGI'
subset_hydroMet(obj, slot_name, from = NULL, to = NULL)
## S4 method for signature 'hydroMet_CR2'
subset_hydroMet(obj, slot_name, from = NULL, to = NULL)
## S4 method for signature 'hydroMet_IANIGLA'
subset_hydroMet(obj, slot_name, from = NULL, to = NULL)
## S4 method for signature 'hydroMet_compact'
subset_hydroMet(obj, slot_name, from = NULL, to = NULL)
Arguments
obj |
an |
slot_name |
string vector with the slot(s) name(s) to subset. NOTE: in case you want to subset a |
from |
string (or |
to |
string (or |
Value
The same hydroMet_XXX
class provided in obj
but subsetted.
Functions
-
subset_hydroMet,hydroMet_BDHI-method
: subset method for BDHI data -
subset_hydroMet,hydroMet_DGI-method
: subset method for DGI data -
subset_hydroMet,hydroMet_CR2-method
: subset method for CR2 data -
subset_hydroMet,hydroMet_IANIGLA-method
: subset method for IANIGLA data -
subset_hydroMet,hydroMet_compact-method
: subset method forcompact
data
Examples
# Create BDHI hydro-met station
guido <- create_hydroMet(class_name = 'BDHI')
# List with meteorological variables (slots in BDHI's object)
cargar <- list('precip', 'Qmd', 'Qmm')
# Assign as names the files
hydro_files <- list.files( system.file('extdata', package = "hydroToolkit"), pattern = 'Guido' )
names(cargar) <- hydro_files
# Build the object with the met records
guido <- build_hydroMet(obj = guido, slot_list = cargar,
path = system.file('extdata', package = "hydroToolkit") )
# Subset daily mean discharge
guido <- subset_hydroMet(obj = guido, slot_name = 'Qmd', from = '2005-01-01',
to = '2010-12-31')