10.4 Getting help

The help() function is special in that it provides information about other functions. This function displays a help page, which is online documentation that describes what a function does. This includes an explanation of all of the arguments to the function and a description of the result produced by the function. Figure 10.1 shows the beginning of the help page for the Sys.sleep() function, which is obtained by typing help(Sys.sleep).

Figure 10.1: The beginning of the help page for the function Sys.sleep() as displayed within an xterm on a Linux system. This help page is displayed by the expression help(Sys.sleep).
 

Sys.sleep                package:base            R Documentation

Suspend Execution for a Time Interval

Description:

     Suspend execution of R expressions for a given number of 
     seconds

Usage:

     Sys.sleep(time)

Arguments:

    time: The time interval to suspend execution for, in seconds.

Details:

     Using this function allows R to be given very low priority 
     and hence not to interfere with more important foreground 
     tasks. A typical use is to allow a process launched from R 
     to set itself up and read its input files before R execution 
     is resumed.

A special shorthand using the question mark character, ?, is provided for getting the help page for a function. Instead of typing help(Sys.sleep), it is also possible to simply type ?Sys.sleep.

There is also a web interface to the help system, which is initiated by typing help.start().

Many help pages also have a set of examples to demonstrate the proper use of the function, and these examples can be run using the example() function.

Paul Murrell

Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 New Zealand License.