Nov 13, 2025
The {cli}1 package contains some helpful tools to make your error messages:
We might want to return x if it’s OK
{cli} gives usFor example, we can mark up a span of text as
.fn class.arg class…Error in `check_string()`:
! `check_string()`: argument `x` is not a valid string
Error in `check_string()`:
! `check_string()`: argument `x` is not a valid string
✖ You supplied `NA`
Error in `my_lower()`:
! `check_string()`: argument `x` is not a valid string
✖ You supplied `NA`
and have fun!
view slides at the-strategy-unit.github.io/data_science/presentations