The book of R a first course in programming and statistics
The Book of R is a comprehensive, beginner-friendly guide to R, the world's most popular programming language for statistical analysis. Even if you have no programming experience and little more than a grounding in the basics of mathematics, you'll find everything you need to begin using R...
Otros Autores: | |
---|---|
Formato: | Libro electrónico |
Idioma: | Inglés |
Publicado: |
San Francisco, California :
No Starch Press
2016.
|
Edición: | 1st edition |
Materias: | |
Ver en Biblioteca Universitat Ramon Llull: | https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009631596706719 |
Tabla de Contenidos:
- Intro
- Title Page
- Copyright Page
- Brief Contents
- Contents in Detail
- Preface
- Acknowledgments
- Introduction
- A Brief History of R
- About This Book
- Part I: The Language
- Part II: Programming
- Part III: Statistics and Probability
- Part IV: Statistical Testing and Modeling
- Part V: Advanced Graphics
- For Students
- For Instructors
- Part I: The Language
- Chapter 1: Getting Started
- 1.1 Obtaining and Installing R from CRAN
- 1.2 Opening R for the First Time
- 1.2.1 Console and Editor Panes
- 1.2.2 Comments
- 1.2.3 Working Directory
- 1.2.4 Installing and Loading R Packages
- 1.2.5 Help Files and Function Documentation
- 1.2.6 Third-Party Editors
- 1.3 Saving Work and Exiting R
- 1.3.1 Workspaces
- 1.3.2 Scripts
- 1.4 Conventions
- 1.4.1 Coding
- 1.4.2 Math and Equation References
- 1.4.3 Exercises
- Exercise 1.1
- Chapter 2: Numerics, Arithmetic, Assignment, and Vectors
- 2.1 R for Basic Math
- 2.1.1 Arithmetic
- 2.1.2 Logarithms and Exponentials
- 2.1.3 E-Notation
- Exercise 2.1
- 2.2 Assigning Objects
- Exercise 2.2
- 2.3 Vectors
- 2.3.1 Creating a Vector
- 2.3.2 Sequences, Repetition, Sorting, and Lengths
- Exercise 2.3
- 2.3.3 Subsetting and Element Extraction
- Exercise 2.4
- 2.3.4 Vector-Oriented Behavior
- Exercise 2.5
- Chapter 3: Matrices and Arrays
- 3.1 Defining a Matrix
- 3.1.1 Filling Direction
- 3.1.2 Row and Column Bindings
- 3.1.3 Matrix Dimensions
- 3.2 Subsetting
- 3.2.1 Row, Column, and Diagonal Extractions
- 3.2.2 Omitting and Overwriting
- Exercise 3.1
- 3.3 Matrix Operations and Algebra
- 3.3.1 Matrix Transpose
- 3.3.2 Identity Matrix
- 3.3.3 Scalar Multiple of a Matrix
- 3.3.4 Matrix Addition and Subtraction
- 3.3.5 Matrix Multiplication
- 3.3.6 Matrix Inversion
- Exercise 3.2
- 3.4 Multidimensional Arrays
- 3.4.1 Definition.
- 3.4.2 Subsets, Extractions, and Replacements
- Exercise 3.3
- Chapter 4: Non-numeric Values
- 4.1 Logical Values
- 4.1.1 TRUE or FALSE?
- 4.1.2 A Logical Outcome: Relational Operators
- Exercise 4.1
- 4.1.3 Multiple Comparisons: Logical Operators
- Exercise 4.2
- 4.1.4 Logicals Are Numbers!
- 4.1.5 Logical Subsetting and Extraction
- Exercise 4.3
- 4.2 Characters
- 4.2.1 Creating a String
- 4.2.2 Concatenation
- 4.2.3 Escape Sequences
- 4.2.4 Substrings and Matching
- Exercise 4.4
- 4.3 Factors
- 4.3.1 Identifying Categories
- 4.3.2 Defining and Ordering Levels
- 4.3.3 Combining and Cutting
- Exercise 4.5
- Chapter 5: Lists and Data Frames
- 5.1 Lists of Objects
- 5.1.1 Definition and Component Access
- 5.1.2 Naming
- 5.1.3 Nesting
- Exercise 5.1
- 5.2 Data Frames
- 5.2.1 Construction
- 5.2.2 Adding Data Columns and Combining Data Frames
- 5.2.3 Logical Record Subsets
- Exercise 5.2
- Chapter 6: Special Values, Classes, and Coercion
- 6.1 Some Special Values
- 6.1.1 Infinity
- 6.1.2 NaN
- Exercise 6.1
- 6.1.3 NA
- 6.1.4 NULL
- Exercise 6.2
- 6.2 Understanding Types, Classes, and Coercion
- 6.2.1 Attributes
- 6.2.2 Object Class
- 6.2.3 Is-Dot Object-Checking Functions
- 6.2.4 As-Dot Coercion Functions
- Exercise 6.3
- Chapter 7: Basic Plotting
- 7.1 Using plot with Coordinate Vectors
- 7.2 Graphical Parameters
- 7.2.1 Automatic Plot Types
- 7.2.2 Title and Axis Labels
- 7.2.3 Color
- 7.2.4 Line and Point Appearances
- 7.2.5 Plotting Region Limits
- 7.3 Adding Points, Lines, and Text to an Existing Plot
- Exercise 7.1
- 7.4 The ggplot2 Package
- 7.4.1 A Quick Plot with qplot
- 7.4.2 Setting Appearance Constants with Geoms
- 7.4.3 Aesthetic Mapping with Geoms
- Exercise 7.2
- Chapter 8: Reading and Writing Files
- 8.1 R-Ready Data Sets
- 8.1.1 Built-in Data Sets.
- 8.1.2 Contributed Data Sets
- 8.2 Reading in External Data Files
- 8.2.1 The Table Format
- 8.2.2 Spreadsheet Workbooks
- 8.2.3 Web-Based Files
- 8.2.4 Other File Formats
- 8.3 Writing Out Data Files and Plots
- 8.3.1 Data Sets
- 8.3.2 Plots and Graphics Files
- 8.4 Ad Hoc Object Read/Write Operations
- Exercise 8.1
- Part II: Programming
- Chapter 9: Calling Functions
- 9.1 Scoping
- 9.1.1 Environments
- 9.1.2 Search Path
- 9.1.3 Reserved and Protected Names
- Exercise 9.1
- 9.2 Argument Matching
- 9.2.1 Exact
- 9.2.2 Partial
- 9.2.3 Positional
- 9.2.4 Mixed
- 9.2.5 Dot-Dot-Dot: Use of Ellipses
- Exercise 9.2
- Chapter 10: Conditions and Loops
- 10.1 if Statements
- 10.1.1 Stand-Alone Statement
- 10.1.2 else Statements
- 10.1.3 Using ifelse for Element-wise Checks
- Exercise 10.1
- 10.1.4 Nesting and Stacking Statements
- 10.1.5 The switch Function
- Exercise 10.2
- 10.2 Coding Loops
- 10.2.1 for Loops
- Exercise 10.3
- 10.2.2 while Loops
- Exercise 10.4
- 10.2.3 Implicit Looping with apply
- Exercise 10.5
- 10.3 Other Control Flow Mechanisms
- 10.3.1 Declaring break or next
- 10.3.2 The repeat Statement
- Exercise 10.6
- Chapter 11: Writing Functions
- 11.1 The function Command
- 11.1.1 Function Creation
- 11.1.2 Using return
- Exercise 11.1
- 11.2 Arguments
- 11.2.1 Lazy Evaluation
- 11.2.2 Setting Defaults
- 11.2.3 Checking for Missing Arguments
- 11.2.4 Dealing with Ellipses
- Exercise 11.2
- 11.3 Specialized Functions
- 11.3.1 Helper Functions
- 11.3.2 Disposable Functions
- 11.3.3 Recursive Functions
- Exercise 11.3
- Chapter 12: Exceptions, Timings, and Visibility
- 12.1 Exception Handling
- 12.1.1 Formal Notifications: Errors and Warnings
- 12.1.2 Catching Errors with try Statements
- Exercise 12.1
- 12.2 Progress and Timing
- 12.2.1 Textual Progress Bars: Are We There Yet?.
- 12.2.2 Measuring Completion Time: How Long Did It Take?
- Exercise 12.2
- 12.3 Masking
- 12.3.1 Function and Object Distinction
- 12.3.2 Data Frame Variable Distinction
- Part III: Statistics and Probability
- Chapter 13: Elementary Statistics
- 13.1 Describing Raw Data
- 13.1.1 Numeric Variables
- 13.1.2 Categorical Variables
- 13.1.3 Univariate and Multivariate Data
- 13.1.4 Parameter or Statistic?
- Exercise 13.1
- 13.2 Summary Statistics
- 13.2.1 Centrality: Mean, Median, Mode
- 13.2.2 Counts, Percentages, and Proportions
- Exercise 13.2
- 13.2.3 Quantiles, Percentiles, and the Five-Number Summary
- 13.2.4 Spread: Variance, Standard Deviation, and the Interquartile Range
- Exercise 13.3
- 13.2.5 Covariance and Correlation
- 13.2.6 Outliers
- Exercise 13.4
- Chapter 14: Basic Data Visualization
- 14.1 Barplots and Pie Charts
- 14.1.1 Building a Barplot
- 14.1.2 A Quick Pie Chart
- 14.2 Histograms
- 14.3 Box-and-Whisker Plots
- 14.3.1 Stand-Alone Boxplots
- 14.3.2 Side-by-Side Boxplots
- 14.4 Scatterplots
- 14.4.1 Single Plot
- 14.4.2 Matrix of Plots
- Exercise 14.1
- Chapter 15: Probability
- 15.1 What Is a Probability?
- 15.1.1 Events and Probability
- 15.1.2 Conditional Probability
- 15.1.3 Intersection
- 15.1.4 Union
- 15.1.5 Complement
- Exercise 15.1
- 15.2 Random Variables and Probability Distributions
- 15.2.1 Realizations
- 15.2.2 Discrete Random Variables
- 15.2.3 Continuous Random Variables
- 15.2.4 Shape, Skew, and Modality
- Exercise 15.2
- Chapter 16: Common Probability Distributions
- 16.1 Common Probability Mass Functions
- 16.1.1 Bernoulli Distribution
- 16.1.2 Binomial Distribution
- Exercise 16.1
- 16.1.3 Poisson Distribution
- Exercise 16.2
- 16.1.4 Other Mass Functions
- 16.2 Common Probability Density Functions
- 16.2.1 Uniform
- Exercise 16.3
- 16.2.2 Normal.
- Exercise 16.4
- 16.2.3 Student's t-distribution
- 16.2.4 Exponential
- Exercise 16.5
- 16.2.5 Other Density Functions
- Part IV: Statistical Testing and Modeling
- Chapter 17: Sampling Distributions and Confidence
- 17.1 Sampling Distributions
- 17.1.1 Distribution for a Sample Mean
- 17.1.2 Distribution for a Sample Proportion
- Exercise 17.1
- 17.1.3 Sampling Distributions for Other Statistics
- 17.2 Confidence Intervals
- 17.2.1 An Interval for a Mean
- 17.2.2 An Interval for a Proportion
- 17.2.3 Other Intervals
- 17.2.4 Comments on Interpretation of a CI
- Exercise 17.2
- Chapter 18: Hypothesis Testing
- 18.1 Components of a Hypothesis Test
- 18.1.1 Hypotheses
- 18.1.2 Test Statistic
- 18.1.3 p-value
- 18.1.4 Significance Level
- 18.1.5 Criticisms of Hypothesis Testing
- 18.2 Testing Means
- 18.2.1 Single Mean
- Exercise 18.1
- 18.2.2 Two Means
- Exercise 18.2
- 18.3 Testing Proportions
- 18.3.1 Single Proportion
- 18.3.2 Two Proportions
- Exercise 18.3
- 18.4 Testing Categorical Variables
- 18.4.1 Single Categorical Variable
- 18.4.2 Two Categorical Variables
- Exercise 18.4
- 18.5 Errors and Power
- 18.5.1 Hypothesis Test Errors
- 18.5.2 Type I Errors
- 18.5.3 Type II Errors
- Exercise 18.5
- 18.5.4 Statistical Power
- Exercise 18.6
- Chapter 19: Analysis of Variance
- 19.1 One-Way ANOVA
- 19.1.1 Hypotheses and Diagnostic Checking
- 19.1.2 One-Way ANOVA Table Construction
- 19.1.3 Building ANOVA Tables with the aov Function
- Exercise 19.1
- 19.2 Two-Way ANOVA
- 19.2.1 A Suite of Hypotheses
- 19.2.2 Main Effects and Interactions
- 19.3 Kruskal-Wallis Test
- Exercise 19.2
- Chapter 20: Simple Linear Regression
- 20.1 An Example of a Linear Relationship
- 20.2 General Concepts
- 20.2.1 Definition of the Model
- 20.2.2 Estimating the Intercept and Slope Parameters.
- 20.2.3 Fitting Linear Models with lm.