R Programming/Documentation

Obtaining Help Edit

For each package you have a reference manual available as an HTML file from within R or as a PDF on the CRAN website. You also often have Vignettes or comprehensive articles in the R Journal, the Journal of Statistical Software, etc.

vignette(all=FALSE) # vignettes for all attached packages
vignette(all=TRUE) # vignettes for all packages on the computer

You can search for help inside all loaded packages using help() or ?. Usually you do not need to add quotes to function names, but sometimes it can be useful. args() gives the full syntax of a function.

function (formula, data, subset, weights, na.action, method = "qr", 
    model = TRUE, x = FALSE, y = FALSE, qr = TRUE, singular.ok = TRUE, 
    contrasts = NULL, offset, ...) 

apropos() and find() looks for all the functions in the loaded packages containing a keyword or a regular expression[1].

#   [1] "dlnorm"         "dnorm"          "plnorm"        
#   [4] "pnorm"          "qlnorm"         "qnorm"         
#   [7] "qqnorm"         "qqnorm.default" "rlnorm"        
#  [10] "rnorm"          "normalizePath"

You can search for help in all installed packages using help.search() or its shortcut ??.


RSiteSearch() looks for help in all packages and in the R mailing lists. The sos package improves the RSiteSearch() function with the findFn() function. ??? is a wrapper for findFn().

findFn("spline", maxPages = 2)

hints() in the hints package suggests what to do with an object.

fit <- lm(y ~ x)
hints(fit) # returns a list of function using lm objects.

Handouts Edit

Teaching Resources Edit

Blogs Edit

Journals Edit

Books Edit

useR and other R conferences Edit

Search Engine Edit

Q&A / Forums Edit

References Edit

  1. If you want to know more about regular expressions, have a look at the Regular expressions section in the Text Processing page.
  2. Introduction to Data Analysis
Previous: Data types Index Next: Sample Session