[R] interactively getting alist of functions for a given package?

Deepayan Sarkar deep@y@n@@@rk@r @end|ng |rom gm@||@com
Thu Jun 24 17:00:50 CEST 2021

On Thu, Jun 24, 2021 at 2:10 PM Greg Minshall <minshall using umich.edu> wrote:
> Duncan,
> > Bert gave you an answer that depends on ls().  Whether there's
> > something like "set<TAB>" that can return "asset" probably depends on
> > your front end, and may be customizable using the facilities described
> > in ?rcompgen.
> thanks.  i am just using command line R on linux.  i tried setting
> `rc.setting(fuzzy=TRUE, func=TRUE, ipck=TRUE)`, but
> `data.table::set<TAB>` still only shows names that start with "set".
> Bert's `ls` answer works, but did you have an idea of how else this
> might be made to work with rcompgen?

That's not currently supported. It would not be difficult to get the
completion mechanism to return these matches; e.g.,

utils:::findMatches("set", ls(getNamespace("data.table")))

You can even experiment a bit with something like (only for normal completions)

complete.partial <- function(.CompletionEnv)
    text <- .CompletionEnv[["token"]]
    comps <- apropos(text)
    .CompletionEnv[["comps"]] <- comps

rc.options(custom.completer = complete.partial)

The problem is that readline's interface doesn't really allow you to
choose one of these completions easily, and you will need to
explicitly type out at least the prefix.

Another problem with namespace completion in particular is that
readline will first complete to a non-trivial common prefix, if any.
This means that if


gives multiple completions, all starting with "data.table::", readline
will delete the "set" part, and subsequent attempts will just try to
complete "data.table::".

So adding an option to allow apropos-type matches is not difficult,
but given that RStudio has its own completion, and the limited
functionality of readline, not sure it's worth the effort.


> cheers, Greg
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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