Beginning R: The Statistical Programming Language

Book description

Conquer the complexities of this open source statistical language

R is fast becoming the de facto standard for statistical computing and analysis in science, business, engineering, and related fields. This book examines this complex language using simple statistical examples, showing how R operates in a user-friendly context. Both students and workers in fields that require extensive statistical analysis will find this book helpful as they learn to use R for simple summary statistics, hypothesis testing, creating graphs, regression, and much more. It covers formula notation, complex statistics, manipulating data and extracting components, and rudimentary programming.

  • R, the open source statistical language increasingly used to handle statistics and produces publication-quality graphs, is notoriously complex

  • This book makes R easier to understand through the use of simple statistical examples, teaching the necessary elements in the context in which R is actually used

  • Covers getting started with R and using it for simple summary statistics, hypothesis testing, and graphs

  • Shows how to use R for formula notation, complex statistics, manipulating data, extracting components, and regression

  • Provides beginning programming instruction for those who want to write their own scripts

Beginning R offers anyone who needs to perform statistical analysis the information necessary to use R with confidence.

Table of contents

  1. Cover
  2. Contents
  3. Chapter 1: Introducing R: What It Is and How to Get It
    1. Getting the Hang of R
      1. The R Website
      2. Downloading and Installing R from CRAN
    2. Running the R Program
    3. Finding Your Way with R
      1. Getting Help via the CRAN Website and the Internet
      2. The Help Command in R
      3. Anatomy of a Help Item in R
    4. Command Packages
      1. Standard Command Packages
      2. What Extra Packages Can Do for You
      3. How to Get Extra Packages of R Commands
      4. Running and Manipulating Packages
    5. Summary
  4. Chapter 2: Starting Out: Becoming Familiar with R
    1. Some Simple Math
      1. Use R Like a Calculator
      2. Storing the Results of Calculations
    2. Reading and Getting Data into R
      1. Using the combine Command for Making Data
      2. Using the scan Command for Making Data
      3. Reading Bigger Data Files
    3. Viewing Named Objects
      1. Viewing Previously Loaded Named-Objects
      2. Removing Objects from R
    4. Types of Data Items
      1. Number Data
      2. Text Items
      3. Converting Between Number and Text Data
    5. The Structure of Data Items
      1. Vector Items
      2. Data Frames
      3. Matrix Objects
      4. List Objects
    6. Examining Data Structure
    7. Working with History Commands
      1. Using History Files
      2. Editing History Files
    8. Saving Your Work in R
      1. Saving the Workspace on Exit
      2. Saving Data Files to Disk
      3. Reading Data Files from Disk
      4. Saving Data to Disk as Text Files
    9. Summary
  5. Chapter 3: Starting Out: Working With Objects
    1. Manipulating Objects
      1. Manipulating Vectors
      2. Manipulating Matrix and Data Frames
      3. Manipulating Lists
    2. Viewing Objects within Objects
      1. Looking Inside Complicated Data Objects
      2. Opening Complicated Data Objects
      3. Quick Looks at Complicated Data Objects
      4. Viewing and Setting Names
      5. Rotating Data Tables
    3. Constructing Data Objects
      1. Making Lists
      2. Making Data Frames
      3. Making Matrix Objects
      4. Re-ordering Data Frames and Matrix Objects
    4. Forms of Data Objects: Testing and Converting
      1. Testing to See What Type of Object You Have
      2. Converting from One Object Form to Another
    5. Summary
  6. Chapter 4: Data: Descriptive Statistics and Tabulation
    1. Summary Commands
    2. Summarizing Samples
      1. Summary Statistics for Vectors
      2. Cumulative Statistics
      3. Summary Statistics for Data Frames
      4. Summary Statistics for Matrix Objects
      5. Summary Statistics for Lists
    3. Summary Tables
      1. Making Contingency Tables
      2. Selecting Parts of a Table Object
      3. Converting an Object into a Table
      4. Testing for Table Objects
      5. Complex (Flat) Tables
      6. Testing “Flat” Table Objects
      7. Summary Commands for Tables
      8. Cross Tabulation
    4. Summary
  7. Chapter 5: Data: Distribution
    1. Looking at the Distribution of Data
      1. Stem and Leaf Plot
      2. Histograms
      3. Density Function
      4. Types of Data Distribution
      5. The Shapiro-Wilk Test for Normality
      6. The Kolmogorov-Smirnov Test
      7. Quantile-Quantile Plots
    2. Summary
  8. Chapter 6: Simple Hypothesis Testing
    1. Using the Student’s t-test
      1. Two-Sample t-Test with Unequal Variance
      2. Two-Sample t-Test with Equal Variance
      3. One-Sample t-Testing
      4. Using Directional Hypotheses
      5. Formula Syntax and Subsetting Samples in the t-Test
    2. The Wilcoxon U-Test (Mann-Whitney)
      1. Two-Sample U-Test
      2. One-Sample U-Test
      3. Using Directional Hypotheses
      4. Formula Syntax and Subsetting Samples in the U-test
    3. Paired t- and U-Tests
    4. Correlation and Covariance
      1. Simple Correlation
      2. Covariance
      3. Significance Testing in Correlation Tests
      4. Formula Syntax
    5. Tests for Association
      1. Multiple Categories: Chi-Squared Tests
      2. Single Category: Goodness of Fit Tests
    6. Summary
  9. Chapter 7: Introduction to Graphical Analysis
    1. Box-whisker Plots
      1. Basic Boxplots
      2. Customizing Boxplots
      3. Horizontal Boxplots
    2. Scatter Plots
      1. Basic Scatter Plots
      2. Adding Axis Labels
      3. Plotting Symbols
      4. Setting Axis Limits
      5. Using Formula Syntax
      6. Adding Lines of Best-Fit to Scatter Plots
    3. Pairs Plots (Multiple Correlation Plots)
    4. Line Charts
      1. Line Charts Using Numeric Data
      2. Line Charts Using Categorical Data
    5. Pie Charts
    6. Cleveland Dot Charts
    7. Bar Charts
      1. Single-Category Bar Charts
      2. Multiple Category Bar Charts
      3. Horizontal Bars
      4. Bar Charts from Summary Data
    8. Copy Graphics to Other Applications
      1. Use Copy/Paste to Copy Graphs
      2. Save a Graphic to Disk
    9. Summary
  10. Chapter 8: Formula Notation and Complex Statistics
    1. Examples of Using Formula Syntax for Basic Tests
    2. Formula Notation in Graphics
    3. Analysis of Variance (ANOVA)
      1. One-Way ANOVA
      2. Simple Post-hoc Testing
      3. Extracting Means from aov() Models
      4. Two-Way ANOVA
      5. Extracting Means and Summary Statistics
      6. Interaction Plots
      7. More Complex ANOVA Models
      8. Other Options for aov()
    4. Summary
  11. Chapter 9: Manipulating Data and Extracting Components
    1. Creating Data for Complex Analysis
      1. Data Frames
      2. Matrix Objects
      3. Creating and Setting Factor Data
      4. Making Replicate Treatment Factors
      5. Adding Rows or Columns
    2. Summarizing Data
      1. Simple Column and Row Summaries
      2. Complex Summary Functions
    3. Summary
  12. Chapter 10: Regression (Linear Modeling)
    1. Simple Linear Regression
      1. Linear Model Results Objects
      2. Similarity between lm() and aov()
    2. Multiple Regression
      1. Formulae and Linear Models
      2. Model Building
    3. Curvilinear Regression
      1. Logarithmic Regression
      2. Polynomial Regression
    4. Plotting Linear Models and Curve Fitting
      1. Best-Fit Lines
      2. Confidence Intervals on Fitted Lines
    5. Summarizing Regression Models
      1. Diagnostic Plots
      2. Summary of Fit
    6. Summary
  13. Chapter 11: More About Graphs
    1. Adding Elements to Existing Plots
      1. Error Bars
      2. Adding Legends to Graphs
      3. Adding Text to Graphs
      4. Adding Points to an Existing Graph
      5. Adding Various Sorts of Lines to Graphs
    2. Matrix Plots (Multiple Series on One Graph)
    3. Multiple Plots in One Window
      1. Splitting the Plot Window into Equal Sections
      2. Splitting the Plot Window into Unequal Sections
    4. Exporting Graphs
      1. Using Copy and Paste to Move a Graph
      2. Saving a Graph to a File
      3. Using the Device Driver to Save a Graph to Disk
    5. Summary
  14. Chapter 12: Writing Your Own Scripts: Beginning to Program
    1. Copy and Paste Scripts
      1. Make Your Own Help File as Plain Text
      2. Using Annotations with the # Character
    2. Creating Simple Functions
      1. One-Line Functions
      2. Using Default Values in Functions
      3. Simple Customized Functions with Multiple Lines
      4. Storing Customized Functions
    3. Making Source Code
      1. Displaying the Results of Customized Functions and Scripts
      2. Displaying Messages as Part of Script Output
    4. Summary
  15. Appendix: Answers to Exercises
    1. Chapter 1
      1. Exercise 1 Solution
      2. Exercise 2 Solution
      3. Exercise 3 Solution
      4. Exercise 4 Solution
      5. Exercise 5 Solution
    2. Chapter 2
      1. Exercise 1 Solution
      2. Exercise 2 Solution
    3. Chapter 3
      1. Exercise 1 Solution
      2. Exercise 2 Solution
      3. Exercise 3 Solution
      4. Exercise 4 Solution
    4. Chapter 4
      1. Exercise 1 Solution
      2. Exercise 2 Solution
      3. Exercise 3 Solution
    5. Chapter 5
      1. Exercise 1 Solution
      2. Exercise 2 Solution
    6. Chapter 6
      1. Exercise 1 Solution
      2. Exercise 2 Solution
      3. Exercise 3 Solution
      4. Exercise 4 Solution
      5. Exercise 5 Solution
    7. Chapter 7
      1. Exercise 1 Solution
      2. Exercise 2 Solution
      3. Exercise 3 Solution
      4. Exercise 4 Solution
      5. Exercise 5 Solution
    8. Chapter 8
      1. Exercise 1 Solution
      2. Exercise 2 Solution
      3. Exercise 3 Solution
      4. Exercise 4 Solution
      5. Exercise 5 Solution
    9. Chapter 9
      1. Exercise 1 Solution
      2. Exercise 2 Solution
      3. Exercise 3 Solution
      4. Exercise 4 Solution
      5. Exercise 5 Solution
    10. Chapter 10
      1. Exercise 1 Solution
      2. Exercise 2 Solution
      3. Exercise 3 Solution
      4. Exercise 4 Solution
      5. Exercise 5 Solution
    11. Chapter 11
      1. Exercise 1 Solution
      2. Exercise 2 Solution
      3. Exercise 3 Solution
      4. Exercise 4 Solution
    12. Chapter 12
      1. Exercise 1 Solution
      2. Exercise 2 Solution
      3. Exercise 3 Solution
      4. Exercise 4 Solution
      5. Exercise 5 Solution
  16. Introduction
  17. Advertisement

Product information

  • Title: Beginning R: The Statistical Programming Language
  • Author(s):
  • Release date: June 2012
  • Publisher(s): Wrox
  • ISBN: 9781118239377