modify_hydroMet {hydroToolkit}R Documentation

Modify data inside a specific slot

Description

Apply a pre-defined (e.g.: movAvg, fill_value or Qmm_to_Dm) or user defined function to an existing series inside a slot.

Usage

modify_hydroMet(
  obj,
  name = NA_character_,
  colName = NA_character_,
  colNum = 2,
  FUN = NULL,
  ...
)

## S4 method for signature 'hydroMet_BDHI'
modify_hydroMet(
  obj,
  name = NA_character_,
  colName = NA_character_,
  colNum = 2,
  FUN = NULL,
  ...
)

## S4 method for signature 'hydroMet_CR2'
modify_hydroMet(
  obj,
  name = NA_character_,
  colName = NA_character_,
  colNum = 2,
  FUN = NULL,
  ...
)

## S4 method for signature 'hydroMet_DGI'
modify_hydroMet(
  obj,
  name = NA_character_,
  colName = NA_character_,
  colNum = 2,
  FUN = NULL,
  ...
)

## S4 method for signature 'hydroMet_IANIGLA'
modify_hydroMet(
  obj,
  name = NA_character_,
  colName = NA_character_,
  colNum = 1,
  FUN = NULL,
  ...
)

Arguments

obj

hydroMet_XXX subclass object. See hydroMet_BDHI, hydroMet_DGI, hydroMet_IANIGLA or hydroMet_CR2.

name

string with the slot name of the data frame.

colName

string with the new column name (from FUN).

colNum

numeric value with the data frame column where to apply FUN. It must be > 1 (except in 'IANIGLA' subclass).

FUN

the function name.

...

FUN arguments to pass.

Value

The same hydroMet subclass provided in obj with an extra column.

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

# Now 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") )


[Package hydroToolkit version 0.1.0 Index]