Some favorite R commands

If Rlogo.jpg was a band, and if that band had a greatest hits album, and if the album featured R commands instead of songs, then the following commands should be counted among the greatest hits (or the most obscure hits).

  • windows(record=T) #place this near the top of your script to record all charts; enables scrolling through and compare charts with page up and page down
  • oldpar <- par(no.readonly=T) #assign default graphical parameters to an object, to be called back later with par(oldpar)
  • windowsFonts(Garamond = windowsFont(“TT Garamond”)) #add a new font family to the standard database
  • file.choose() #allows you to choose a file interactively instead of specifying the path and file name in quotes
  • describe() #a better alternative to summary(); from library(psych)
  • qq.plot() #plots a quantile-comparison chart with confidence bands; in library(car)
  • prplot() #a function in library(faraway) that produces partial residual plots
  • Make.Z() #normalizes all variables in a data frame, available in library(QuantPsyc)
  • ci.rc() #calculates a regression coefficient confidence interval, in library(MBESS)
  • hccm() #another from library(car); calculates heteroscedasticity-corrected covariance matrices for unweighted linear models
  • lmer() #a function in library(lme4) that fits linear mixed models
  • identify() #use this function in library(graphics) to label points in a scatter plot
This entry was posted in Praxes. Bookmark the permalink.