By Andrie de Vries, Joris Meys

Part of R For Dummies Cheat Sheet

Even with good introductory books on R, you’ll need to use the R Help files. The R Help files provide detailed information about the use of different functions and their peculiarities. R has excellent built-in help for every function that explains how to use that function. Just about every Help page has some examples that demonstrate how to use that function.

To search through the Help files, you’ll use one of the following functions:

  • ?: Displays the Help file for a specific function. For example, ?data.frame displays the Help file for the data.frame() function.

  • ??: Searches for a word (or pattern) in the Help files. For example, ??list returns the names of functions that contain the word list in either the function names or their descriptions.

  • RSiteSearch(): Performs an online search of RSiteSearch. This search engine allows you to perform a search of the R functions, package vignettes and the R-help mail archives. For example, RSiteSearch(linear models) does a search at this website for the search term “linear models.”

You aren’t limited to the R Help files if you’re looking for help with R. The add-on package sos, available for download from CRAN here, has some neat functions to search all the Help files on RSiteSearch. It displays results in a web browser window, making it easy to work with.

To use the package sos, you need to install the package by typing install.packages(sos) in your R console, and then load the package with library(sos).

Then you can use the findFn() function to do your search. For example, by typing findFn(regression) into your R console, you get a web page with the names, descriptions and links to several hundred functions that contain the word regression in the function name or Help text description.