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

David Winsemius dwinsemius at comcast.net
Thu Jul 1 19:40:48 CEST 2010


On Jul 1, 2010, at 1:24 PM, Allan Engelhardt wrote:

> 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)

I have always used:

help(package=MASS)   # does not need to be quoted

My annoyance/whine is that various functions use "pkg", pkgs", or  
"package" as argument names. This is the only one I have successfully  
committed to memory.


>
> 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

-- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list