[R] display full form in args

Adaikalavan Ramasamy ramasamy at cancer.org.uk
Fri Feb 25 14:38:27 CET 2005


Prof. Ripley,

As usual thank you for helpful comments. 

In future, I will check methods("cut") or methods("merge") which shows
the available methods before using args() on the appropriate function.

Thanks again.

Regards, Adai



On Fri, 2005-02-25 at 12:52 +0000, Prof Brian Ripley wrote:
> On Fri, 25 Feb 2005, Adaikalavan Ramasamy wrote:
> 
> > Forgive me for I do not fully comprehend the idea of classes and methods
> > but I was wondering if someone could help explain why the function args
> > () behaves the way it does.
> >
> > Why does args(cut) show the simplified version instead of the more
> > complete one as in help("cut"). This is true for few other functions
> > (e.g. plot, rep).
> >
> > > args(cut)
> > function (x, ...)
> 
> 
> Adai,
> 
> That _is_ the full form: those are formal arguments shared by all methods.
> For help(cut) I get
> 
> Usage:
> 
>       cut(x, ...)
> 
> which is the same.
> 
> > Sometime I can get around this by using the "default" method as in
> >
> > > args(cut.default)
> > function (x, breaks, labels = NULL, include.lowest = FALSE, right =
> > TRUE, dig.lab = 3, ...)
> 
> but other methods have other args, e.g.
> 
> > args(cut.Date)
> function (x, breaks, labels = NULL, start.on.monday = TRUE, right = FALSE,
>      ...)
> 
> > But sometimes I cannot use this workaround. e.g. args(merge.default)
> > does not give the full form as in the help file.
> 
> It is the *data frame* method that you are looking at in the help file.
> 
> Usage:
> 
>       merge(x, y, ...)
> 
>       ## Default S3 method:
>       merge(x, y, ...)
> 
>       ## S3 method for class 'data.frame':
>       merge(x, y, by = intersect(names(x), names(y)),
>             by.x = by, by.y = by, all = FALSE, all.x = all, all.y = all,
>             sort = TRUE, suffixes = c(".x",".y"), ...)
> 
> 
> > I find it almost always useful to see the full form. Is there a more
> > reliable workaround or do I have to look up the help to be certain.
> 
> You can look at the method you want to use.  Try not to overlook those 
> comments in the help files' usage sections.
> 
>




More information about the R-help mailing list