Skip to contents

This function replaces the 'actual' values in a dataframe ('params_df') at the specified index ('idx_2_replace') based on the provided list of actual values ('list_actual').

Usage

replace_actual(idx_2_replace, params_df, list_actual)

Arguments

idx_2_replace

Index or indices in 'params_df' where 'actual' values will be replaced.

params_df

Dataframe containing the parameters where 'actual' values need to be replaced.

list_actual

List of actual values to use for replacement.

Value

Updated dataframe ('params_df') with 'actual' values replaced at the specified index/indices.

Examples

params_df <- data.frame(ID = c("param.1", "param.2", "param.3"), actual = c(0.5, 0.8, 1.2))
list_actual <- list(0.3, 0.6, 1.0)
replace_actual(2, params_df, list_actual)
#>        ID actual
#> 1 param.1    0.5
#> 2 param.2    0.6
#> 3 param.3    1.2