An essential library of basic commands you can copy and paste into R
The powerful and open-source statistical programming language R is rapidly growing in popularity, but it requires that you type in commands at the keyboard rather than use a mouse, so you have to learn the language of R. But there is a shortcut, and that's where this unique book comes in. A companion book to Visualize This: The FlowingData Guide to Design, Visualization, and Statistics, this practical reference is a library of basic R commands that you can copy and paste into R to perform many types of statistical analyses.
Whether you're in technology, science, medicine, business, or engineering, you can quickly turn to your topic in this handy book and find the commands you need.
Simplify the complex statistical R programming language with The Essential R Reference.
.Dr. Mark Gardener is an ecologist, lecturer, and writer who discovered R while doing data analysis for his doctorate in ecology and evolutionary biology. He conducts courses in R, ecology, and data analysis for a variety of organizations. Mark is also the author of Beginning R: The Statistical Programming Language, a Wrox book published by Wiley.
Introduction xv
Theme 1: Data 1
Data Types 3
Types of Data 3
Altering Data Types 16
Testing Data Types 18
Creating Data 22
Creating Data from the Keyboard 22
Creating Data from the Clipboard 29
Adding to Existing Data 29
Importing Data 39
Importing Data from Text Files 39
Importing Data from Data Files 46
Saving Data 49
Saving Data as a Text File to Disk 50
Saving Data as a Data File to Disk 59
Viewing Data 61
Listing Data 61
Data Object Properties 74
Selecting and Sampling Data 107
Sorting and Rearranging Data 117
Summarizing Data 121
Summary Statistics 121
Summary Tables 136
Distribution of Data 146
Density Functions 148
Probability Functions 152
Quantile Functions 158
Random Numbers 161
Theme 2: Math and Statistics 167
Mathematical Operations 169
Math 169
Logic 188
Complex Numbers .194
Trigonometry 202
Hyperbolic Functions 206
Matrix Math 206
Summary Statistics 223
Simple Summary Stats 223
Tests of Distribution 235
Differences Tests 240
Parametric Tests 241
Non-parametric 252
Correlations and Associations 267
Correlation 267
Association and Goodness of Fit 275
Analysis of Variance and Linear Modeling 283
ANOVA 284
Linear Modeling 300
Miscellaneous Methods 317
Clustering 318
Ordination 324
Time Series 331
Non-linear Modeling and Optimization 333
Theme 3: Graphics 347
Making Graphs 348
Types of Graphs 349
Saving Graphs 389
Adding to Graphs 398
Adding Data 398
Adding Lines 404
Adding Shapes 416
Adding Text 422
Adding Legends 432
Graphical Parameters 436
Using the par Command 437
Altering Color 439
Altering Axis Parameters 446
Altering Text Parameters 453
Altering Line (and Box) Parameters 456
Altering Plot Margins 459
Altering the Graph Window 462
Theme 4: Utilities 475
Install 476
Installing R 477
Installing Packages 477
Using R 480
Using the Program 480
Additional Packages 486
Programming 490
Managing Functions 491
Saving and Running Scripts 498
Conditional Control 502
Returning Results 507
Error Trapping 525
Constants 527
Index 529