Statistiek: introductie tot R


3. Programming basics
October 07, 2020 23:00

We teach R because it greatly facilitates data analysis, the main topic of this book. By coding in R, we can efficiently perform exploratory data analysis, build data analysis pipelines, and prepare data visualization to communicate results. However, R is not just a data analysis environment but a programming language. Advanced R programmers can develop complex packages and even improve R itself, but we do not cover advanced programming in this book. Nonetheless, in this section, we introduce three key programming concepts: conditional expressions, for-loops, and functions. These are not just key building blocks for advanced programming, but are sometimes useful during data analysis. We also note that there are several functions that are widely used to program in R but that we will not cover in this book. These include split, cut, do.call, and Reduce, as well as the data.table package. These are worth learning if you plan to become an expert R programmer.

Title Class progress
3.0 Introduction
3.1 Conditional expressions
3.2 Defining functions
3.3 Namespaces
3.4 For-loops
3.5 Vectorization and functionals
3.6.1 Conditional expression
3.6.2 Any and all
3.6.3 Conditional changes
3.6.4 Sum of the first n integers
3.6.5 Functions with multiple variables
3.6.6 Namespace
3.6.7-8 Sum of the first n squares (I)
3.6.9 Sum of the first n squares (II)
3.6.10 Sum of the first n squares (III)