Getting help and documentation

Install required packages

sos

wants <- c("sos")
has   <- wants %in% rownames(installed.packages())
if(any(!has)) install.packages(wants[!has])

R's own help system

Help system for R functions

help.start()
help(round)
?round
?"/"
# not shown (opens browser window)
args(round)
function (x, digits = 0) 
NULL
example(round)

round> round(.5 + -2:4) # IEEE rounding: -2  0  0  2  2  4  4
[1] -2  0  0  2  2  4  4

round> ( x1 <- seq(-2, 4, by = .5) )
 [1] -2.0 -1.5 -1.0 -0.5  0.0  0.5  1.0  1.5  2.0  2.5  3.0  3.5  4.0

round> round(x1) #-- IEEE rounding !
 [1] -2 -2 -1  0  0  0  1  2  2  2  3  4  4

round> x1[trunc(x1) != floor(x1)]
[1] -1.5 -0.5

round> x1[round(x1) != floor(x1 + .5)]
[1] -1.5  0.5  2.5

round> (non.int <- ceiling(x1) != floor(x1))
 [1] FALSE  TRUE FALSE  TRUE FALSE  TRUE FALSE  TRUE FALSE  TRUE FALSE
[12]  TRUE FALSE

round> x2 <- pi * 100^(-1:3)

round> round(x2, 3)
[1] 3.100e-02 3.142e+00 3.142e+02 3.142e+04 3.142e+06

round> signif(x2, 3)
[1] 3.14e-02 3.14e+00 3.14e+02 3.14e+04 3.14e+06

Getting help without knowing the function name

help.search("mean")
# not shown (opens browser window)
apropos("mean")
 [1] ".colMeans"       ".rowMeans"       "colMeans"       
 [4] "kmeans"          "mean"            "Mean"           
 [7] "Mean.areg.boot"  "mean.data.frame" "mean.Date"      
[10] "mean.default"    "mean.difftime"   "mean.POSIXct"   
[13] "mean.POSIXlt"    "rowMeans"        "smean.cl.boot"  
[16] "smean.cl.normal" "smean.sd"        "smean.sdl"      
[19] "weighted.mean"   "wtd.mean"       
library(sos)                  # for findFn()
findFn("Petal.Length")
# not shown (opens browser window)

Online documentation

Search, mailing lists and Q&A sites

Introductory websites and texts

Official documentation

Books

Introductory statistics

  • Dalgaard, P. (2008). Introductory Statistics with R (2nd ed.). London, UK: Springer. URL
  • Maindonald, J. & Braun, W. J. (2010). Data Analysis and Graphics Using R: An Example-Based Approach (3rd ed.). Cambridge, UK: Cambridge University Press. URL
  • Wollschlaeger, D. (2012). Grundlagen der Datenanalyse mit R (2nd ed.). Heidelberg: Springer. URL

Specialized and advanced statistical topics

  • Chihara, L. & Hesterberg, T. (2011). Mathematical Statistics with Resampling and R. Hoboken, NJ: Wiley. URL
  • Everitt, B. S. & Hothorn, T. (2010). A Handbook of Statistical Analysis Using R (2nd ed.). Boca Raton, FL: Chapman & Hall/CRC.
  • Everitt, B. S. & Hothorn, T. (2011). An Introduction to Applied Multivariate Analysis with R. New York, NY: Springer.
  • Fox, J. & Weisberg, S. (2011). An R Companion to Applied Regression (2nd ed.). Thousand Oaks, CA: Sage. URL
  • Harrell, F. (2001). Regression Modeling Strategies. New York, NY: Springer. URL
  • Pinheiro, J. C. & Bates, D. M. (2000). Mixed-Effects Models in S and S-PLUS. New York, NY: Springer.
  • Shumway, R. H. & Stoffer, D. S. (2011). Time Series Analysis and Its Applications (3rd ed.). New York, NY: Springer. URL
  • Spector, P. (2008). Data Manipulation with R. New York, NY: Springer.
  • Venables, W. N. & Ripley, B. D. (2002). Modern Applied Statistics with S (4th ed.). New York, NY: Springer. URL

Diagrams

  • Murrell, P. (2011). R Graphics (2nd ed.). Boca Raton, FL: Chapman & Hall/CRC. URL
  • Sarkar, D. (2008). Lattice: Multivariate Data Visualization with R. New York, NY: Springer. URL
  • Wickham, H. (2009). ggplot2: Elegant Graphics for Data Analysis. New York, NY: Springer. URL

Programming with R

Transition from other statistical software packages

Detach (automatically) loaded packages (if possible)

try(detach(package:sos))
try(detach(package:brew))

Get the article source from GitHub

R markdown - markdown - R code - all posts