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 hydroMet_XXX class object.

slot_name

string vector with the slot(s) name(s) to subset. NOTE: in case you want to subset a hydroMet_IANIGLA object is recommended to consider all the slots with data.

from

string (or POSIXct - valid only in 'BDHI' and 'IANIGLA') with the starting Date. You can use from without to. In this case you will subset your data 'from' till the end.

to

string (or POSIXct - valid only in 'BDHI' and 'IANIGLA') with the ending Date. You can use to without from. In this case you will subset your data from the beginning till 'to'.

Value

The same hydroMet_XXX class provided in obj but subsetted.

Functions

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')


[Package hydroToolkit version 0.1.0 Index]