Learn R Programming

hydroToolkit (version 0.1.0)

modify_hydroMet: 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 hydroMet_BDHI modify_hydroMet( obj, name = NA_character_, colName = NA_character_, colNum = 2, FUN = NULL, ... )

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

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

# S4 method for 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

  • modify_hydroMet,hydroMet_BDHI-method: modify method for BDHI class

  • modify_hydroMet,hydroMet_CR2-method: modify method for CR2 class

  • modify_hydroMet,hydroMet_DGI-method: modify method for DGI class

  • modify_hydroMet,hydroMet_IANIGLA-method: modify method for IANIGLA class

Examples

Run this code
# NOT RUN {
# 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") )

# }

Run the code above in your browser using DataLab