tutorizeR turns ordinary R chunks into student exercise
areas and hidden or collapsible solution material. For
learnr, the setup chunk includes learnr and
activates gradethis_setup() when gradethis is
installed, so that instructors can add answer checks after
conversion.
```r
# tutorizeR: hints=Use group_by() before summarise()|Remember .groups = "drop"
activity |>
group_by(program) |>
summarise(
mean_hours = mean(study_hours),
mean_score = mean(quiz_score),
.groups = "drop"
)
```
After conversion, instructors can add gradethis checks
to generated exercise chunks using the normal learnr
conventions:
```r
grade_this({
pass_if(~ identical(names(.result), c("program", "mean_hours", "mean_score")))
fail("Check the grouping variable and summary column names.")
})
```
This pattern keeps the initial conversion automated while leaving final grading logic under instructor control.
Feedback should focus on the learning objective rather than only the final answer. For example, an exercise about grouped summaries should check that students identify the grouping variable, compute the intended summaries, and produce a tidy table.