R Programming for Data Science
Course Info
This course includes 5 attempts.
Data science has taken the world by storm. Every field of study and area of business has been affected as people increasingly realize the value of the incredible quantities of data being generated. But to extract value from those data, one needs to be trained in the proper data science skills. The R programming language has become the de facto programming language for data science. Its flexibility, power, sophistication, and expressiveness have made it an invaluable tool for data scientists around the world.
This course is about the fundamentals of R programming. You will get started with the basics of the language, learn how to manipulate datasets, how to write functions, and how to debug and optimize code. With the fundamentals provided in this book, you will have a solid foundation on which to build your data science toolbox.
This course is based on the book R Programming for Data Science.
Course Material
- 1: Introduction
- 1.1: Stay in Touch!
- 1.2: Preface
- 2: History and Overview of R
- 2.1: What is R?
- 2.2: What is S?
- 2.3: The S Philosophy
- 2.4: Back to R
- 2.5: Basic Features of R
- 2.6: Free Software
- Exercise 1
- 2.7: Design of the R System
- Exercise 2
- 2.8: Limitations of R
- Exercise 3
- 2.9: R Resources
- 2.9.1: Official Manuals
- 2.9.2: Useful Standard Texts on S and R
- 2.9.3: Other Resources
- Quiz 13 attempts allowed
- 3: Getting Started with R
- 3.1: Installation
- 3.2: Getting started with the R interface
- 4: R Nuts and Bolts
- 4.1: Entering Input
- Exercise 4
- 4.2: Evaluation
- Exercise 5
- 4.3: R Objects
- Exercise 6
- 4.4: Numbers
- Exercise 7
- 4.5: Attributes
- Exercise 8
- 4.6: Creating Vectors
- Exercise 9
- 4.7: Mixing Objects
- Exercise 10
- 4.8: Explicit Coercion
- 4.9: Matrices
- Exercise 11
- 4.10: Lists
- Exercise 12
- 4.11: Factors
- Exercise 13
- 4.12: Missing Values
- Exercise 14
- 4.13: Data Frames
- Exercise 15
- 4.14: Names
- 4.15: Summary
- Exercise 16
- Quiz 23 attempts allowed
- 5: Getting Data In and Out of R
- 5.1: Reading and Writing Data
- Exercise 17
- 5.2: Reading Data Files with read.table()
- Exercise 18
- 5.3: Reading in Larger Datasets with read.table
- Exercise 19
- 5.4: Calculating Memory Requirements for R Objects
- Exercise 20
- Quiz 33 attempts allowed
- 6: Using the readr Package
- Exercise 21
- Quiz 43 attempts allowed
- 7: Using Textual and Binary Formats for Storing Data
- Exercise 22
- 7.1: Using dput() and dump()
- Exercise 23
- 7.2: Binary Formats
- Exercise 24
- Quiz 53 attempts allowed
- 8: Interfaces to the Outside World
- 8.1: File Connections
- Exercise 25
- 8.2: Reading Lines of a Text File
- Exercise 26
- 8.3: Reading From a URL Connection
- Exercise 27
- Quiz 63 attempts allowed
- 9: Subsetting R Objects
- 9.1: Subsetting a Vector
- Exercise 28
- 9.2: Subsetting a Matrix
- 9.2.1: Dropping matrix dimensions
- Exercise 29
- 9.3: Subsetting Lists
- Exercise 30
- 9.4: Subsetting Nested Elements of a List
- Exercise 31
- 9.5: Extracting Multiple Elements of a List
- Exercise 32
- 9.6: Partial Matching
- Exercise 33
- 9.7: Removing NA Values
- Exercise 34
- Quiz 73 attempts allowed
- 10: Vectorized Operations
- Exercise 35
- 10.1: Vectorized Matrix Operations
- Exercise 36
- Quiz 83 attempts allowed
- 11: Dates and Times
- 11.1: Dates in R
- Exercise 37
- 11.2: Times in R
- Exercise 38
- 11.3: Operations on Dates and Times
- Exercise 39
- 11.4: Summary
- Exercise 40
- Quiz 93 attempts allowed
- 12: Managing Data Frames with the dplyr package
- 12.1: Data Frames
- 12.2: The dplyr Package
- 12.3: dplyr Grammar
- 12.3.1: Common dplyr Function Properties
- Exercise 41
- 12.4: Installing the dplyr package
- Exercise 42
- 12.5: select()
- Exercise 43
- 12.6: filter()
- Exercise 44
- 12.7: arrange()
- Exercise 45
- 12.8: rename()
- Exercise 46
- 12.9: mutate()
- Exercise 47
- 12.10: group_by()
- Exercise 48
- 12.11: %>%
- Exercise 49
- 12.12: Summary
- Quiz 103 attempts allowed
- 13: Control Structures
- 13.1: if-else
- Exercise 50
- 13.2: for Loops
- 13.3: Nested for loops
- Exercise 51
- 13.4: while Loops
- 13.5: repeat Loops
- Exercise 52
- 13.6: next, break
- Exercise 53
- 13.7: Summary
- Exercise 54
- Quiz 113 attempts allowed
- 14: Functions
- 14.1: Functions in R
- Exercise 55
- 14.2: Your First Function
- Exercise 56
- 14.3: Argument Matching
- Exercise 57
- 14.4: Lazy Evaluation
- 14.5: The ... Argument
- Exercise 58
- 14.6: Arguments Coming After the ... Argument
- Exercise 59
- 14.7: Summary
- Exercise 60
- Quiz 123 attempts allowed
- 15: Scoping Rules of R
- 15.1: A Diversion on Binding Values to Symbol
- Exercise 61
- 15.2: Scoping Rules
- Exercise 62
- 15.3: Lexical Scoping: Why Does It Matter?
- Exercise 63
- 15.4: Lexical vs. Dynamic Scoping
- Exercise 64
- 15.5: Application: Optimization
- Exercise 65
- 15.6: Plotting the Likelihood
- Exercise 66
- 15.7: Summary
- Quiz 133 attempts allowed
- 16: Coding Standards for R
- Exercise 67
- Quiz 143 attempts allowed
- 17: Loop Functions
- 17.1: Looping on the Command Line
- Exercise 68
- 17.2: lapply()
- Exercise 69
- 17.3: sapply()
- Exercise 70
- 17.4: split()
- Exercise 71
- 17.5: Splitting a Data Frame
- Exercise 72
- 17.6: tapply
- Exercise 73
- 17.7: apply()
- Exercise 74
- 17.8: Col/Row Sums and Means
- Exercise 75
- 17.9: Other Ways to Apply
- Exercise 76
- 17.10: mapply()
- Exercise 77
- 17.11: Vectorizing a Function
- Exercise 78
- 17.12: Summary
- Quiz 153 attempts allowed
- 18: Regular Expressions
- 18.1: Before You Begin
- 18.2: Primary R Functions
- Exercise 79
- 18.3: grep()
- Exercise 80
- 18.4: grepl()
- Exercise 81
- 18.5: regexpr()
- Exercise 82
- 18.6: sub() and gsub()
- Exercise 83
- 18.7: regexec()
- Exercise 84
- 18.8: The stringr Package
- Exercise 85
- 18.9: Summary
- Exercise 86
- Quiz 163 attempts allowed
- 19: Debugging
- 19.1: Something’s Wrong!
- Exercise 87
- 19.2: Figuring Out What’s Wrong
- Exercise 88
- 19.3: Debugging Tools in R
- Exercise 89
- 19.4: Using traceback()
- Exercise 90
- 19.5: Using debug()
- Exercise 91
- 19.6: Using recover()
- Exercise 92
- 19.7: Summary
- Exercise 93
- Quiz 173 attempts allowed
- 20: Profiling R Code
- 20.1: Using system.time()
- Exercise 94
- 20.2: Timing Longer Expressions
- Exercise 95
- 20.3: The R Profiler
- Exercise 96
- 20.4: Using summaryRprof()
- Exercise 97
- 20.5: Summary
- Exercise 98
- Quiz 183 attempts allowed
- 21: Simulation
- 21.1: Generating Random Numbers
- Exercise 99
- 21.2: Setting the random number seed
- 21.3: Simulating a Linear Model
- Exercise 100
- 21.4: Random Sampling
- Exercise 101
- 21.5: Summary
- Exercise 102
- Quiz 193 attempts allowed
- 22: Data Analysis Case Study: Changes in Fine Particle Air Pollution in the U.S.
- 22.1: Synopsis
- 22.2: Loading and Processing the Raw Data
- 22.2.1: Reading in the 1999 data
- 22.2.2: Reading in the 2012 data
- Exercise 103
- 22.3: Results
- 22.3.1: Entire U.S. analysis
- 22.3.2: Changes in PM levels at an individual monitor
- 22.3.3: Changes in state-wide PM levels
- Exercise 104
- Quiz 203 attempts allowed
- 23: Parallel Computation
- 23.1: Hidden Parallelism
- 23.1.1: Parallel BLAS
- Exercise 105
- 23.2: Embarrassing Parallelism
- Exercise 106
- 23.3: The Parallel Package
- 23.3.1: mclapply()
- 23.3.2: Error Handling
- Exercise 107
- 23.4: Example: Bootstrapping a Statistic
- 23.4.1: Generating Random Numbers
- 23.4.2: Using the boot package
- 23.5: Building a Socket Cluster
- 23.6: Summary
- Quiz 213 attempts allowed
- 24: Why I Indent My Code 8 Spaces
- 25: About the Author
Instructors
Roger D. Peng is a Professor of Statistics and Data Sciences at the University of Texas, Austin. Previously, he was Professor of Biostatistics at the Johns Hopkins Bloomberg School of Public Health. His research focuses on the development of statistical methods for addressing environmental health problems and on developing tools for doing better data analysis. He is the author of the popular book R Programming for Data Science and 10 other books on data science and statistics. He is also the co-creator of the Johns Hopkins Data Science Specialization, the Simply Statistics blog where he writes about statistics for the public, the Not So Standard Deviations podcast with Hilary Parker, and The Effort Report podcast with Elizabeth Matsui. Roger is a Fellow of the American Statistical Association and is the recipient of the Mortimer Spiegelman Award from the American Public Health Association, which honors a statistician who has made outstanding contributions to public health. He can be found on Twitter and GitHub at @rdpeng.
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.
You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!
So, there's no reason not to click the Add to Cart button, is there?
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $14 millionwriting, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them