[R] Ways to get all function signatures of a library?
Gabor Grothendieck
ggrothendieck at gmail.com
Wed Oct 29 17:13:11 CET 2014
On Wed, Oct 29, 2014 at 9:09 AM, Thorsten Jolitz <tjolitz at gmail.com> wrote:
>
> Hi List,
>
> are there ways to get signatures of all functions of a library in a
> format that is easy to process by a programm (list, xml or so)?
>
> The info about function name, return value and arguments (types) is all
> there in the docs, but more in a human readable format embedded in much
> extra information. How to extract it without writing a documentation
> parser or so? I'm pretty sure the functionality exists, but did not find
> it.
>
In general, R functions do not have argument and return types (and
don't even have to have names) but maybe this would do:
library(lattice) # need this for make.groups
# load the package of interest
library(zoo)
DF <- do.call(make.groups, Map(function(x) names(formals(get(x))),
ls("package:zoo")))
rownames(DF) <- NULL
giving:
> head(DF)
data which
1 x as.Date
2 ... as.Date
3 x as.Date.numeric
4 origin as.Date.numeric
5 ... as.Date.numeric
6 x as.Date.ts
--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com
More information about the R-help
mailing list