Skip to content

potential issue in download.file() help page

1 message · Jeff Newmiller

#
cc'ing the list for archive thread closure and possible additional comments.

My own preference leans toward simple default values as well, but if you are hoping to warn students about alternative interpretations of function signatures then be sure to point out the match.arg [1][2] convention also, in which the function author can specify that the default value listed in the signature is a vector of values that is interpreted to constrain the legal values that can be specified for an argument and omitting any value for that argument defaults to the function assuming the first value in the vector. This behavior relies on some advanced features of R to work (how does the function refer to both the user-specified argument values and the programmer's default vector at the same time?) so it tends to look like magic to a beginner. I think it looks inconsistent, but it is fairly common and students should be forewarned that it represents one of the four (I think) ways default arguments might be portrayed in a function signature: simple, missing, match.arg, and ellipsis.

Ellipsis arguments are indicated with ... and you have to read the documentation (usually via See Also) to know what other function documentation you need to read in order to find all possible argument and default signatures. The read.csv function is a classic example where you need to know that it is a wrapper around read.table and (almost) any of the arguments to read.table may be specified when calling read.csv. (Read.csv forces some arguments to specific values to enforce the definition of that format.)

[1] https://stat.ethz.ch/R-manual/R-devel/library/base/html/match.arg.html

[2] http://mazamascience.com/WorkingWithData/?p=1659
On November 5, 2018 3:38:14 AM PST, "St?phane Guillou" <stephane.guillou at member.fsf.org> wrote: