[R] Check functions in package

Kingsford Jones kingsfordjones at gmail.com
Tue Jul 28 23:11:40 CEST 2009


a couple more options:

> ls("package:glmnet")
 [1] "coef.glmnet"     "glmnet"          "jerr"
"nonzeroCoef"     "plot.glmnet"
 [6] "plotCoef"        "predict.elnet"   "predict.glmnet"
"predict.lognet"  "predict.multnet"
[11] "print.glmnet"
> # or
> ls(pos = 2)
 [1] "coef.glmnet"     "glmnet"          "jerr"
"nonzeroCoef"     "plot.glmnet"
 [6] "plotCoef"        "predict.elnet"   "predict.glmnet"
"predict.lognet"  "predict.multnet"
[11] "print.glmnet"

The above works because glmnet is in the 2nd position in my search list:

> search()
 [1] ".GlobalEnv"        "package:glmnet"    "package:Matrix"
"package:lattice"   "package:stats"
 [6] "package:graphics"  "package:grDevices" "package:utils"
"package:datasets"  "package:methods"
[11] "Autoloads"         "package:base"


hth,
Kingsford

On Tue, Jul 28, 2009 at 2:24 PM, Steve
Lianoglou<mailinglist.honeypot at gmail.com> wrote:
> Hi,
>
> On Jul 28, 2009, at 4:16 PM, voidobscura wrote:
>
>>
>> Hi, I run R on a server via SSH, over a terminal.  After loading a
>> specific
>> package, how do I know what functions are in that package?  Is there any
>> way
>> to list or display them?
>
>
> Here's one way. Let's say I load the "glmnet" package, at the prompt I could
> use tab-completion to which functions are exported:
>
> R> library(glmnet)
> R> glmnet::<TAB><TAB>
> glmnet::coef.glmnet      glmnet::jerr             glmnet::plot.glmnet
> glmnet::predict.elnet    glmnet::predict.lognet   glmnet::print.glmnet
> glmnet::glmnet           glmnet::nonzeroCoef      glmnet::plotCoef
> glmnet::predict.glmnet   glmnet::predict.multnet
>
> <TAB><TAB> is hitting the tab key twice in quick succession.
>
> There are probably better ways, but there's one option.
>
> -steve
>
> --
> Steve Lianoglou
> Graduate Student: Computational Systems Biology
>  |  Memorial Sloan-Kettering Cancer Center
>  |  Weill Medical College of Cornell University
> Contact Info: http://cbio.mskcc.org/~lianos/contact
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>




More information about the R-help mailing list