72

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?

LearneR
  • 2,351
  • 3
  • 26
  • 50
  • 1
    you can try `library(help="dplyr" )`, but it will show only the user defined functions, for example the one which do not begin with a point – Mamoun Benghezal May 22 '15 at 09:04
  • @MamounBenghezal Just tried out the command you gave. That was what I was looking for. Very helpful... Thank you so much. – LearneR May 22 '15 at 09:08
  • See also ["find all functions (including private) in a package"](http://stackoverflow.com/questions/8696158/find-all-functions-including-private-in-a-package/8696442#8696442) – Henrik May 22 '15 at 09:17

1 Answers1

137

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.

moodymudskipper
  • 46,417
  • 11
  • 121
  • 167
nico
  • 50,859
  • 17
  • 87
  • 112
  • 1
    Oh that final part `dplyr::` (and ctrl+spacebar for the autocomplete list) was completely new to me.. thanks again. – LearneR May 22 '15 at 09:16
  • @KrishnaKanth the newer (beta) versions of RStudio have automatic autocomplete (without having to press CTRL+SPACE) as well as other goodness such as debugging and more! – nico May 22 '15 at 10:57