Online Exercises

Adding to your Code School badges/pins in the shared doc, complete the below exercises and use copied screenshots to attest your learning of each exercise.  Please note, that "example" code and results are provided for each exercise.  But try hard to solve it on your own first; brain research has shown that more synapses are generated by persisting through mistakes. There are numerous R code references on the web to help you with these exercises, each with their own style.  A few are provided below.

Graphical tips in R
R-Tutorial: Quantitative Statistics
R-Project
Stat Methods


Exercise 1 - Boxplot
  • Copy and paste the below data to a new "input.txt" file.
  • Read in the data and print (to screen) it.
  • Compute summary statistics for both variables, section and count.
  • Make a boxplot of the count data.
  • Add a title for the chart.
Exercise 1- Data
section,count
04,26
07,48
03,42
07,42
02,40
04,40
08,40
01,39
04,17
02,17
02,16
08,16

example code and results (click to expand)


Exercise 2 - Histogram
  • Copy and paste the below data to a new "input.txt" file.
  • Read in the data and print it.
  • Compute summary statistics for just the count column.
  • Make a histogram plot of the count column.
  • Add title and y-axis label.
  • Add an abline at the mean.
Exercise 2- Data
section,count
04,26
07,48
03,42
07,42
02,40
04,40
08,40
01,39
04,17
02,17
02,16
08,16

example code and results (click to expand)


Exercise 3 - Scatterplot
  • Copy and paste the below data to a new "input.txt" file.
  • Read in the data and print it.
  • Compute summary statistics for just the waiting column.
  • Make a two variable plot of eruptions vs waiting.
  • Place an abline at the median value.
  • Make a red title for the graph, using a font size of 4.
Exercise 3 - Data
duration,waiting
3.600,79
1.800,54
3.333,74
2.283,62
4.533,85
2.883,55
    example code and results (click to expand)


    Exercise 4 - Correlation Coefficient
    • Copy and paste the below data to a new "input.txt" file.
    • Read in the data and print it.
    • Compute summary statistics for both variables.
    • Make a plot of duration vs waiting.
    • Conduct a linear-model, correlation coefficient between the two variables; duration and waiting.
    • Add an abiline for the correlated linear model. 
    Exercise 4 - Data
    duration,waiting
    3.600,79
    1.800,54
    3.333,74
    2.283,62
    4.533,85
    2.883,55





      example code and results (click to expand)