Homework Assignment: Visualizing Absenteeism by Employee Characteristics

In this chapter we sliced the data by event-level variables: when each absence happened, how long it lasted, and why. For this homework you will slice the data by employee characteristics instead, building visualizations that explore who is most affected by absenteeism.

The dataset includes several employee-level variables you have not yet used in a chart:

  • Age — the employee’s age in years.
  • Education — coded 1 (high school) through 4 (postgraduate).
  • Distance from Residence to Work — kilometers from home to the workplace.
  • Body mass index — the employee’s BMI.
  • Son — number of children.
  • Social drinker, Social smoker — coded 0 (no) or 1 (yes).

Using the same raw dataset we used in this chapter:

work <- read_delim(
  "https://ljkelly3141.github.io/datasets/bi-book/Absenteeism_at_work.csv",
  delim = ";"
)

Build a short visual report that answers two of the following questions. For each question, you must (a) state the question explicitly, (b) choose a chart type from this chapter that matches the question, (c) build the chart in ggplot2, and (d) write a one-paragraph reading of what the chart shows. Your two questions must use two different chart types between them.

  1. Does absenteeism vary by education level? (Hint: education is categorical with four levels — a faceted bar chart or box plot would both be defensible.)
  2. Is there a relationship between distance from home and absence duration? (Hint: both variables are continuous — a chart type from Chapter 7 that we did not use in this chapter is the natural fit.)
  3. Do social drinkers and social smokers have different absenteeism patterns? (Hint: think about whether you want to compare totals, distributions, or both.)
  4. How does the heat-map idea generalize? Build a heat map of total hours absent across two employee characteristics of your choice (for example, education × number of children, or age band × social drinker).

For each chart, justify your design choices the way the chapter does: why this chart type for this question, what your y-axis represents, what color encodes (if anything), and what you chose to leave out.

Deliverable. Produce a Quarto or R Markdown document containing your code, both charts, and your written interpretations. Render to either HTML or DOCX. Your report should be roughly 1–2 pages of finished output and should read as a self-contained mini-analysis a colleague could follow without seeing your screen.