replace the items of one object by another
Usage
replace_item(x, y, keep_extra = FALSE)
Arguments
- x
number, character or list
- y
another object, the class of y should be same as x
- keep_extra
whether keep extra items in y
Examples
x <- list(A = 1, B = 3)
y <- list(A = 9, C = 10)
replace_item(x, y)
#> $A
#> [1] 9
#>
#> $B
#> [1] 3
#>
replace_item(x, y, keep_extra = TRUE)
#> $A
#> [1] 9
#>
#> $B
#> [1] 3
#>
#> $C
#> [1] 10
#>