replace_vecelements {LWFBrook90R} | R Documentation |
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)
[Package LWFBrook90R version 0.5.3 Index]