Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding R help pages not named for specific commands

Tags:

r

help-system

Most of R's help pages are designed to provide documentation of particular commands, and can easily be found if you know the command and are trying to figure out how to use it. But there are a number of help pages that do not relate primarily to single commands, but to programming tools or techniques that affect many individual commands, and where the name of the page is not the name of any command. Examples include the help pages for "regex", and "connections", "Internal Generic Functions", and many more.

I worry that there are things I ought to know documented somewhere in this set of help pages that I do not know how to find. Is there a published list of such pages I could explore? Or is there a way of using R or R help functions to produce such a list?

I once figured out how to produce a list of all the R commands in the usual distribution -- on the order of 2000 if I recall correctly -- but I have no idea how to find a matchable list of help page names.

After reading the helpful and interesting answers below, I have realized that this is a more difficult problem than I thought. By means of:

things <- mget(ls("package:base"), inherits = TRUE)
fns <- Filter(is.function, unique(things))
length(fns)

we learn that there are 1169 unique functions in the base package. Following G. Grothendieck's suggestion below, we learn that there are 1216 help pages associated with the base package. So at least 47 of these pages speak to something other than specific functions. But the number is actually much larger than this, because there are many help pages that provide information on multiple functions, while I am unaware of any functions that have more than incidental treatment on multiple pages. So putting them into the correct correspondence would require additional examination of each page.

For instance, consider the help page entitled "funprog". Its short description is "Common Higher-Order Functions in Functional Programming Languages". You can get to it by searching on one of the six functions it discusses (Reduce, Filter, Find, Map, Negate, Position). In the list of help pages from Grothendieck's suggestion below, this page does not appear under its page name, but only under "Reduce", which has to stand in for the other five functions. But that means there are five more pages that are not associated with a specific function, but with something else. I was hoping for some mechanical way of matching functions to their help pages and producing a complete list of the residual pages. It is not going to be that easy.

In addition, poking around based on suggestions below led me to 33 vignettes associated with base and recommended packages, of which I was generally unaware. I think it is hard to draw a conceptual line between these vignettes and the help pages not associated with specific commands, like the funprog help page described above.

like image 206
andrewH Avatar asked Aug 04 '17 22:08

andrewH


2 Answers

Try help.start() and explore the links that it gives you.

Also try help(package = base) and also for other out-of-the-box packages including stats, graphics, grDevices, utils, datasets and methods.

like image 139
G. Grothendieck Avatar answered Nov 28 '22 20:11

G. Grothendieck


help.search can probably, uh, help. For example, help.search("regex") gives a list of help files related to regex. It can support regular expressions like help.search("opti*"), or you can use the keyword argument to get help pages based on topics, e.g. help.search(keyword="array"). You can use file.show(paste0(R.home("doc"), "/KEYWORDS")) to get a list of R help keywords.

Of course, this function is only as good as the documentation of the packages you are using. If a package developer doesn't specify keywords in their docs, you won't find what you are looking for with the keyword argument.

like image 40
mikeck Avatar answered Nov 28 '22 20:11

mikeck