Common R Stuff
Download and Install R Package
Load a Module
Scrape an HTML Table
getting help with ?<command-name>
- type a ?rnorm, to pop open a manual Page on the R command rnorm
- or try ?boxplot to get a help page on the R boxplot function
Using Famous Datasets
Reading Data into R from Files
Reading Data from STDIN
- To read data from STDIN, call the scan function with the file parameter left blank
- Enter a blank line or Ctrl D to end data input
Reading a Line of Space Separated Data into a vector
Generating a Histogram
Trimmed Mean to the Rescue
Drawing a Scatterplot with a Linear Regression line
Putting 2 plots on 1 image
Using Reduce and Map
Reduce takes a vector of values, and a binary function and accumulates the values returned over the entire vector of values.
Map takes a vector of values and a unary function, runs the function on each value and returns the vector of return values.
here's how to combine them
This function returns the cumulative distribution function of P(x<4) of X~poisson(5).