[R] Documentation for library() and how to specify missing arguments

Allan Engelhardt allane at cybaea.com
Thu Jul 1 19:24:25 CEST 2010


I can, after carefully reading about the returned values, see why

library("MASS", "MASS", character.only=TRUE)

has to chose between loading the package and displaying the help (I 
thought I had found a nice shortcut), but wouldn't the documentation be 
better if it said that the two are incompatible and that package= takes 
precedence over help=?


As an aside, is there a way to explicitly specify a missing argument in 
a function call?  For an example using the same function as before,

library(, "MASS", character.only=TRUE)

displays the help but can be a little hard on the programmer's eyes.  
However,

library(NULL, "MASS", character.only=TRUE)
library(NA, "MASS", character.only=TRUE)
library({}, "MASS", character.only=TRUE)  #  signals error.

doesn't do the same at all (I thought the first one would, based on the 
"whenever" in the documentation: "It is used whenever there is a need to 
indicate or specify that an object is absent.").

Is there in the language a lexical x such that f(x, ...) is the same as 
f(, ...)?

(Yes, I know about named arguments and I like them, I am just trying to 
learn syntax here.)

Allan



More information about the R-help mailing list