Home Page Icon
Home Page
Table of Contents for
Hands-On Programming with R
Close
Hands-On Programming with R
by Garrett Grolemund
Hands-On Programming with R
Foreword
Preface
Conventions Used in This Book
SafariĀ® Books Online
How to Contact Us
Acknowledgments
I. Project 1: Weighted Dice
1. The Very Basics
The R User Interface
Objects
Functions
Sample with Replacement
Writing Your Own Functions
The Function Constructor
Arguments
Scripts
Summary
2. Packages and Help Pages
Packages
install.packages
library
Getting Help with Help Pages
Parts of a Help Page
Getting More Help
Summary
Project 1 Wrap-up
II. Project 2: Playing Cards
3. R Objects
Atomic Vectors
Doubles
Integers
Characters
Logicals
Complex and Raw
Attributes
Names
Dim
Matrices
Arrays
Class
Dates and Times
Factors
Coercion
Lists
Data Frames
Loading Data
Saving Data
Summary
4. R Notation
Selecting Values
Positive Integers
Negative Integers
Zero
Blank Spaces
Logical Values
Names
Deal a Card
Shuffle the Deck
Dollar Signs and Double Brackets
Summary
5. Modifying Values
Changing Values in Place
Logical Subsetting
Logical Tests
Boolean Operators
Missing Information
na.rm
is.na
Summary
6. Environments
Environments
Working with Environments
The Active Environment
Scoping Rules
Assignment
Evaluation
Closures
Summary
Project 2 Wrap-up
III. Project 3: Slot Machine
7. Programs
Strategy
Sequential Steps
Parallel Cases
if Statements
else Statements
Lookup Tables
Code Comments
Summary
8. S3
The S3 System
Attributes
Generic Functions
Methods
Method Dispatch
Classes
S3 and Debugging
S4 and R5
Summary
9. Loops
Expected Values
expand.grid
for Loops
while Loops
repeat Loops
Summary
10. Speed
Vectorized Code
How to Write Vectorized Code
How to Write Fast for Loops in R
Vectorized Code in Practice
Loops Versus Vectorized Code
Summary
Project 3 Wrap-up
A. Installing R and RStudio
How to Download and Install R
Windows
Mac
Linux
Using R
RStudio
Opening R
B. R Packages
Installing Packages
Loading Packages
C. Updating R and Its Packages
R Packages
D. Loading and Saving Data in R
Data Sets in Base R
Working Directory
Plain-text Files
read.table
sep
header
na.strings
skip and nrow
stringsAsFactors
The read Family
read.fwf
HTML Links
Saving Plain-Text Files
Compressing Files
R Files
Saving R Files
Excel Spreadsheets
Export from Excel
Copy and Paste
XLConnect
Reading Spreadsheets
Writing Spreadsheets
Loading Files from Other Programs
Connecting to Databases
E. Debugging R Code
traceback
browser
Break Points
debug
trace
recover
Index
Colophon
Copyright
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
Cover
Next
Next Chapter
Foreword
Hands-On Programming with R
Garrett
Grolemund
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset