Skip to main content

Getting Help in R

There are a number of different ways to get help in R. An introduction to a few of them follows. There is a vast array of tutorials available online (e.g. this introduction to R, available as a PDF file [PDF]) easily found via Google.

Use the help available from the Help menu in R

There are many options available on the Help menu, the most useful to us are: Manuals, Search Help, R functions, and HTML help. The names of each one are fairly descriptive. Try them out to see where they take you.

Use the help() command

To find information for a particular function, such as the function print, type help('print') on the R command line and press enter (I recommend using quotes whenever you use this command, but there are some special cases when they are unnecessary). This will open up a window with information on how to use the required function.

Typing help() on the R command line and pressing enter will open a window telling you a bit on how to use the help()command

Alternatively, the same results can be achieved by typing a question mark followed by the name of the command to query. For instance, to bring up the help file for the function print, type ?print into the command line.

Use the help.search() command

If you don't know the name of the command you are looking for then this is the command for you. Used in the same way as the help() command, this will bring up a list of places in the help file where your word occurs. Then use the help() function to look up this references.

e.g. Typing help.search('affymetrix') brings up lots of topics relating to Affymetrix microarrays.

Use the help.start() command

This opens the HTML help browser, just as picking the option from the help menu would do.

Vignettes

Perhaps the most useful sort of help is something R calls a vignette. These are far more like how-to guides for topics, and usually offer gentle introductions and examples. To get a list of all available vignettes type vignette() followed by the return key. Once you see one you are interested in use the openVignette() command to open it.

Alternatively, you can view vignettes from any loaded packages by going to the 'Vignettes' menu and selecting the required package name. This will give a list of all available vignettes for you to open. Sometimes this menu doesn't appear until you load a package which has a vignette.

N.B. A package must be loaded for you to be able to open its vignettes, even if you can see them in the list of vignettes. To load a package you can type the command library(packagename), or use the menu "Packages", "Load Packages..." and select from the list of installed packages.

Books

There are a number of good books that cover R and/or its commercial variant, S, such as:

  • Modern Applied Statistics with S (W.N.Venables & B.D.Ripley)

MOAC has a few relevant books in its library.