That particular usage is a bit of a clever shorthand (it’s the same thing that’s going on in examples 6 and 7 on the doc page, which are equivalent). I think it might be clearer written out more verbosely:
invoke_map_dbl(.f = spread, .x = list(NULL), x = x)
Combine that with this condensed excerpt from the docs:
|
|
.f |
…for invoke_map a list of functions. |
.x |
…for invoke_map a list of argument-lists the same length as .f (or length 1). The default argument, list(NULL) , will be recycled to the same length as .f , and will call each function with no arguments (apart from any supplied in ... ). |
... |
Additional arguments passed to each function. |
All of the functions in the list spread take an argument x. Here, x is supplied as one of the “additional arguments” passed via .... It happens to refer to the object x, a vector of 100 values. Since nothing is passed to invoke_map_dbl()’s argument .x, nothing other than the ... argument is passed to the functions in spread, so each function is called with x = x.
As in example 6, the same thing could also be accomplished with:
invoke_map_dbl(spread, list(list(x = x)))
But you can maybe see why that’s an awkward syntax in this case!