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

Gabor Grothendieck ggrothendieck at gmail.com
Fri Jul 2 15:38:47 CEST 2010

On Fri, Jul 2, 2010 at 9:27 AM, Jeffrey J. Hallman <jhallman at frb.gov> wrote:
> Gabor Grothendieck <ggrothendieck at gmail.com> writes:
>> Try this:
>>> mx <- formals(identity)$x
>>> missing(mx)
>> [1] TRUE
>>> sin(mx)
>> Error in sin(mx) : 'mx' is missing
> Neat. There's no way to look at 'mx' because calling any function
> with it as an argument gives that same error message, including the auto
> print function. What exactly is 'mx' here?

You can't look at mx directly but you can look look at the expression
that generates it to see that its a component of a pairlist with class
"name" and type "symbol" :

> class(formals(identity))
[1] "pairlist"
> class(formals(identity)$x)
[1] "name"
> typeof(formals(identity)$x)
[1] "symbol"

More information about the R-help mailing list