I recently saw a function in R where someone had used . as an argument. I can’t seem to find any documentation on this (other than the use of ellipsis or “dot-dot-dot”). Can someone either point me in the direction of documentation or provide an example of usage?
hello.world <- function(.) "Hello World"
# function(.) is what I'm asking about.
Dot is a a valid character in symbol names just like any letter, so
.is no different than let’s saya– it has no special meaning in this context. You can write things like:It may look strange but is valid in R. The above use
function(.)is let’s say unusual, but syntactically valid. Since the author did not reference.in the function body, we will never know if he meant...or just used it because he could.