Exercise: let it type, check what it says
Session 7 — Applied Data Science 2026
The board has started using an AI assistant itself. Last week it produced a complete “market analysis” in two minutes, and the board would like to know whether it can be trusted. It also wants one more chart — and you may use an assistant to make it.
Alone or in pairs. Three parts, named after three of the four Ds: Description, Discernment and Diligence. The fourth, Delegation, is a question inside the first part.
You need a free AI chat assistant in your browser — any one you like.
Create session07.qmd in your project, with this setup chunk:
```{r}
#| label: setup
#| include: false
library(tidyverse)
library(scales)
library(here)
i_am("session07.qmd")
prices <- read_csv(here("data", "hotels-europe_price.csv"))
features <- read_csv(here("data", "hotels-europe_features.csv"))
theme_board <- function(base_size = 13) {
theme_minimal(base_size = base_size) +
theme(
plot.title = element_text(face = "bold"),
plot.title.position = "plot",
plot.caption = element_text(colour = "grey45", hjust = 0),
plot.caption.position = "plot",
panel.grid.minor = element_blank(),
legend.position = "top",
legend.justification = "left"
)
}
```And download ai-analysis.qmd into the same folder as session07.qmd — next to data/. You need it for Discernment.
Description — asking well
Write the prompt
Board: “In which European cities is a four-star hotel cheapest — and where does Vienna stand?”
Use these nine cities: Amsterdam, Berlin, Budapest, Lisbon, London, Paris, Prague, Rome, Vienna.
Write a prompt that carries everything you know. Use this template and fill in every line — the gaps are the point:
I'm working in R with the tidyverse. I have two data frames, `prices` and
`features`, joined by `hotel_id`. Here is glimpse() of each:
[paste the output of glimpse(prices) and glimpse(features)]
Question: ___
Rows: ___ (which date? which accommodation type? which cities?
city and city_actual? how are half stars handled?)
Summary: ___ (mean or median — and why?)
Chart: ___ (the mapping sentence: what goes on x, on y, what is colour?)
Style: tidyverse only, no base R; write data = and mapping = aes()
explicitly; use my function theme_board() (below). Do not write a title —
I will.
Copy the finished prompt into your session07.qmd, in a text block.
Delegation: below the prompt, answer in two or three sentences. Which of the three ways of working is this — automation, augmentation or agency? Which decisions in this chart are yours, and what do you leave to the assistant?
Run it, check it, make it yours
- Paste the code the assistant gives you into a chunk. Run it.
- Check
n: how many four-star hotels are in each city? Is any city thin? - Recompute one number yourself — Vienna’s median, for example — in a different way.
- Now write the title yourself, stating the finding — with every number in it computed by your code, not by the assistant. Add subtitle and caption.
- Run the session 6 checklist over the chart.
Do not ask it to “fix it”. Paste the exact error message and the line that caused it. And check whether it invented a column or a file that you do not have — a chat in the browser sees only what you pasted.
starshas half stars. Four stars meansfloor(stars + 0.5) == 4.city == "Vienna"alone keeps hotels in the suburbs. You also wantcity_actual.- Only one date — otherwise every hotel appears up to ten times.
Discernment — checking what you get
Render the AI analysis
Open ai-analysis.qmd and render it. It is a complete “market analysis”, written in the style of an AI assistant. Every chunk runs. Every number it prints is computed correctly from the data it was given.
Still, it contains six errors. They are in what is computed, what is shown and what is claimed.
Find them
For each error you find, note in your session07.qmd:
| Where | section and chunk |
| What is wrong | in one sentence |
| How you caught it | which step of the routine: run · n · recompute · checklist · read |
- Section 1: is
pricea price per night or per stay? Look atcount(prices, year, month, nnights). - Section 2: what does
n()count? - Section 3, first chart: the checklist.
- Section 3, second chart: what is a difference of 0.4 on a log10 axis?
- Section 4: where are the hotels at 7 to 13 km? And what does “worth” claim that “charge” does not?
Fix three
Pick three errors and fix them — in your own document, with the honest number or the honest chart and a sentence that says what is actually true.
Diligence — declaring it
Write the AI declaration for today, as you would at the end of a report. Answer the six questions from the lecture, as a table or in six short sentences:
| Tool | which assistant, where |
| Used for | which tasks |
| My input | what you put into the prompts |
| What I checked | which steps of the routine, on what |
| What I changed | what you rejected or rewrote, and why |
| My own | what the assistant did not touch |
“I used ChatGPT” is not a declaration.
If you finish early
a) Ask the assistant to check the analysis
Paste ai-analysis.qmd into your assistant and ask it to find the errors. How many of the six does it find? Does it find errors that are not there?
b) Ask twice
Send your prompt from Description again, in a new chat. Is the code the same? Is the chart?
c) Make it explain
Ask it to explain theme_board() line by line. Then close the chat and explain it to a fellow student.
d) Chat or agent
If you have access to a coding agent that works inside your project — for example the assistant built into RStudio, Positron or VS Code — give it the task from Description, without the glimpse() output and without the rows. Which of the chat’s problems disappear? Which rows does it choose — and did it ask?