I want a function that allows me to update a value (by name) within a list. I was imagining something like some_function
here:
original <- list(x = 1, y = 2)
some_function(original, x = 2)
#> $x
#> [1] 2
#>
#> $y
#> [1] 2
Does a function that does this already exist? It feels like there probably is something in base
but I haven't been able to find it.
Or, is there an alternative data structure that it better suited to this? Something more like a map or dict?