19.5 … (dot-dot-dot)
!!! is also useful in other places where you have a list of expressions you want to insert into a call.
Two motivating examples:
List of dataframes you want to rbind
(a list of arbitrary length)
How to supply an argument name indirectly?
- For the first one, we can use unquote (splice) in `dplyr::bind_rows``
This is known ‘splatting’ in some other langauges (Ruby, Go, Julia). Python calls this argument unpacking (**kwarg
)
- For the second we need to unquote the left side of an
=
. Tidy eval lets us do this with a special:=
- Functions that have these capabilities are said to have tidy dots (or apparently now it is called dynamic dots). To get this capability in your own functions, use
list2
!