4 Getting help

R has built-in documentation that helps to understand how to use a function, operation, etc.

4.1 help()

One can type in the console




or select a written command with the mouse and press the command+h keys simultaneously to get the corresponding documentation entry of command.

Although command may be entered without quotation marks most of the times, there are some reserved words that need to be escaped using them, so it’s safer to always use quotation marks.

4.2 Status bar

Some times, it’s useful to be reminded the arguments of a function. When one type a command in the console, R shows the possible arguments and their defaults in the status bar, as shown in Figure 4.1

Status bar of the console showing the possible options for the help() command.

Figure 4.1: Status bar of the console showing the possible options for the help() command.

4.3 help.search()

The help.search() and its alias ?? are useful to search for information on a given topic. Try for example,

??"comparison of proportions"

This will open a tab/window of your default web browser with pointers to libraries relevant to your search if they exist. In our case, you should at least get stats::pairwise.prop.test Pairwise comparisons for proportions.

4.4 Other help sources

  • The command example(topic) reproduce an example of the requested topic if there is one available.
  • I often found useful the examples provided at the end of the help page of a topic.
  • Also, manuals and vignettes available at https://cran.r-project.org/ are very useful.
    • A vignette is a kind of tutorial accompanying a library written by its developers.
  • There are numerous online resources and forums where to find information. Some of these are:
  • NOTE: When asking help on an Internet forum, always include the versions of your OS, R, and libraries in question. For R related versions, use the command sessionInfo().