STATISTICS

THE ART & SCIENCE OF LEARNING FROM DATA

AGRESTI  ·  FRANKLIN  ·  KLINGENBERG

R Code to reproduce analysis in the text

Chapter 1:

Chapter 2:

For each Example, the PDF file shows the code and the correspoding R output. The raw R code is found in the R Code link as a text file. You can either copy and paste the content of this file directly into the R console or open and view it with an editor such as R Studio.

  • ​​Example 2: Shark Attacks - Proportions and Percentages: PDF   R-Code

  • Example 3: U.S. Shark Attacks - Pie Charts and Bar ChartsPDF   R-Code

  • Example 4: Sodium Content of Cereals - DotplotsPDF   R-Code

  • Example 5: Sodium Content of Cereals - Stem & Leaf PlotPDF   R-Code

  • Example 6: TV Hours per Day - HistogramPDF   R-Code

  • Example 7: Sodium Content of Cereals - HistogramPDF   R-Code

  • Example 9: Warming Trends in New York City - Time TrendPDF   R-Code

  • Example 10: Sodium Content - Mean & MedianPDF   R-Code

  • Exercise 2.11: Using the Alligator Food Choice  to demonstrate creating basic frequency tables (count and percentages) and Barcharts, Pareto Charts and Pie Charts: PDF     R-Code