intermediate - 2 - packages

# install.packages() # need administrator privileges

# loads packages
# attaches them to the search list on your R workspace
# library() 
library(ggplot2)
require(ggplot2)

# The library() and require() functions 
# are not very picky 
# when it comes down to argument types: 
# both library(rjson) and library("rjson") 
# work perfectly fine for loading a package.

# look at the currently attached packages
search()
##  [1] ".GlobalEnv"        "package:ggplot2"   "package:stats"    
##  [4] "package:graphics"  "package:grDevices" "package:utils"    
##  [7] "package:datasets"  "package:methods"   "Autoloads"        
## [10] "package:base"

# build a plot of two variables of the mtcars data frame.
qplot(mtcars$wt, mtcars$hp)