Add named item (including NULL
) to a list.
Arguments
- l
A list.
- key
A character scalar: name under which
value
will be placed.- value
Any object.
Examples
add_item_to_list(list(1, a = 2), "b")
#> [[1]]
#> [1] 1
#>
#> $a
#> [1] 2
#>
#> $b
#> NULL
#>