Reputation: 1510
I want to see a list of the available commands in an R package, ideally, outputted to the console. In RStudio, I can type the name of a package, followed by two colons (e.g. ggplot2::
) and RStudio's GUI will pop up a list of available commands. Is this such a list? Even so, I can't get that to output to the console, and it doesn't work in vanilla R. Any alternatives?
Upvotes: 0
Views: 1143
Reputation: 1080
This gets all the functions in particular package. Here's all the functions in tidyr:
objs <- mget(ls("package:tidyr"), inherits = TRUE)
funs <- Filter(is.function, objs)
Upvotes: 2
Reputation: 94237
> require(ggplot2)
Then
> ls("package:ggplot2")
[1] "%+%" "aes"
[3] "aes_" "aes_all"
[5] "aes_auto" "aes_q"
[7] "aes_string" "alpha"
[9] "annotate" "annotation_custom"
[etc]
You can also use ls()
with a position on the search list, eg
> ls(pos=2)
Get the search list with search()
.
Upvotes: 2