Instructor Notes

This is a placeholder file. Please add content here.

Before we Start


Introduction to R


Starting with Data


Instructor Note

Why do we use <- instead of =?

= works for assigning values to objects. However = is also used when we specify values of arguments in function calls. This means that = functions differently depending on context, whereas <- always function in the same way. This means that we do not have to have a deeper understanding of the context when we encounter <-. That reduces the cognitive load, and we are stressed enough as it is.



Data Wrangling with dplyr and tidyr


A couple of plots. And making our own functions


Instructor Note

The purpose is mostly to have additional material. Introducing ggplot is probably too complicated, so we stick to the base-plotting functions.



Instructor Note

The ~ is often difficult to locate. AltGr + ¨/^ is used on most computers running Windows. We do not encounter many Linux-users, and they tend to either know where to find it, or are on a Windows-computer. Macs… option+¨. Sometimes. Depending on the model.

Considder emphasizing the connection to the formula notation of R. We are making a boxplot of imdb_score as a function of genre.



Instructor Note

The output of the function is by default the result of the last operation called in the function definition. Using return() to control the output is discouraged, unless we have a function that returns early - eg where a logical control yields different results.



What is the next step?What should I do next?