If passed two lists, the standard append()
function will concatenate the
lists, rather than treating the second list as a value that should be
appended to the list. In contrast, the lappend()
function will always
append individual values to a list (it does this by making sure that each
element is encapsulated in its own list before using base::append()
to put
it in the original list).
Importantly, this approach correctly allows adding a data.frame
to a list,
whereas calling base::append()
directly will add each column as a separate
element.
Usage
lappend(l, ..., .after = length(l))