View source: R/replace_vec_elem.R
replace_vecelements | R Documentation |
Replace elements in a data.frame or vector of length > 1 by name
replace_vecelements(x, varnms, vals)
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. |
The vector or data.frame in x with the elements 'varnms' replaced by vals.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.