8.1 Loading the Data
We begin by loading the dataset. For this chapter we use the raw, event-level data — the same 740-row file we first loaded in Chapter 4 — rather than the cleaned per-employee dataset built in Chapter 6. The reason is that most of the questions in this chapter are about when and how absences happen: by month, by day of the week, by reason. Each row in the raw file is a single absence event, which is exactly the unit of analysis those questions require. The cleaned dataset from Chapter 6 aggregates to one row per employee, which would obscure the patterns we want to see.
work <- read_delim(
"https://ljkelly3141.github.io/datasets/bi-book/Absenteeism_at_work.csv",
delim = ";"
)As in Chapter 4, the column names contain spaces (Month of absence, Absenteeism time in hours, etc.). We will reference them with backticks throughout this chapter.