Skip to content

Data transformation and reading a file

Learning outcomes

  • Comfortable with the third and seventh chapter of R for Data Science
  • Can use the pipe operator
  • Can use a filter
  • Can use the logical equal operator
  • Can read a file
For teachers

Teaching goals are:

Prior question:

  • Which verbs do you associate with working with data?
  • What is tidy data?
  • What is a pipe?
  • When to use a pipe?
  • What is the different between = and ==?

Feedback questions:

  • What is tidy data?
  • What is a pipe?
  • When to use a pipe?
  • What is the different between = and ==?

Why data transformations are important

The dplyr logo

Whenever you have your raw data, this is rarely shown in a paper as-is. Instead, you will probably show only certain columns, or certain subsets, give average over categories, etc. All these things are called 'data transformations'.

Why reading a file is important

Whenever you have your raw data, you have it in one or more files. To do data transformations, you will first need to read it.

Exercises

Exercise 1

Answers

See the answers here

Note that the answers use chapter 4.2.

Exercise 2

Answers

See the answers here

Note that the answers use chapter 8.2.4.