I would like to know if there is a command, using which one can view all the functions that are built into an R package.
For example, let's say I loaded a package into environment:
require(dplyr)
Now, I would like to get a list of all the functions present in the dplyr
package.
Is there any way to get such a list?
We can find the functions inside a package by using lsf.
If you look at the package listing in the Packages panel, you will find a package called datasets. Simply check the checkbox next to the package name to load the package and gain access to the datasets. You can also click on the package name and RStudio will open a help file describing the datasets in this package.
A shortcut in R Studio is to put the cursor on the function name and press F2 . It's a nice feature when digging through nested functions.
You can use lsf.str
.
For instance:
lsf.str("package:dplyr")
To list all objects in the package use ls
ls("package:dplyr")
Note that the package must be attached.
To see the list of currently loaded packages use
search()
Alternatively calling the help would also do, even if the package is not attached:
help(package = dplyr)
Finally, you can use RStudio which provides an autocomplete function. So, for instance, typing dplyr::
in the console or while editing a file will result in a popup list of all dplyr
functions/objects.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With