Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

replace_vecelements

Replace elements in a data.frame or vector of length > 1 by name


Description

Replace elements in a data.frame or vector of length > 1 by name

Usage

replace_vecelements(x, varnms, vals)

Arguments

x

A vector or data.frame.

varnms

Variable names to match: Specify position by name and index.

vals

Vector of values to insert at the specified positions.

Value

The vector or data.frame in x with the elements 'varnms' replaced by vals.

Examples

soil_materials <- data.frame(ths = rep(0.4,3), alpha = rep(23.1, 3))

varnms = c("soil_materials.ths3", "soil_materials.ths1", "soil_materials.alpha2")
vals = c(0.999, 0.001, 99)
soil_materials
replace_vecelements(soil_materials, varnms, vals)

x <- set_paramLWFB90()[["pdur"]]
varnms <- c("pdur2", "pdur12")
vals <- c(0,10)
x
replace_vecelements(x, varnms, vals)

LWFBrook90R

Simulate Evapotranspiration and Soil Moisture with the SVAT Model LWF-Brook90

v0.4.4
GPL-3
Authors
Paul Schmidt-Walter [aut, cre] (<https://orcid.org/0000-0003-2699-0893>), Volodymyr Trotsiuk [aut] (<https://orcid.org/0000-0002-8363-656X>), Klaus Hammel [aut], Martin Kennel [aut], Anthony Federer [aut], Robert Nuske [ctb] (<https://orcid.org/0000-0001-9773-2061>), Bavarian State Institute of Forestry (LWF) [cph, fnd], Northwest German Forest Research Institute (NW-FVA) [cph, fnd]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.