From 0e7d893b7294484c063427e584e4fdf783ce17c0 Mon Sep 17 00:00:00 2001 From: Stefan Kuethe Date: Tue, 26 Nov 2024 17:34:00 +0100 Subject: [PATCH] Update vignette --- vignettes/typewriter.Rmd | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vignettes/typewriter.Rmd b/vignettes/typewriter.Rmd index 419793d..2346275 100644 --- a/vignettes/typewriter.Rmd +++ b/vignettes/typewriter.Rmd @@ -93,11 +93,17 @@ A typed structure could be used as input for a function: ```{r} say_hello_to <- function(person) { + stopifnot(inherits(person, "Person")) paste("Hello", person$name, "you are", person$age, "years old!") } hanna <- Person(name = "Hanna", age = 10L) say_hello_to(hanna) + +hanna_as_list <- list(name = "Hanna", age = 10L) +try( + say_hello_to(hanna_as_list) +) ``` You can also use it to validate a data frame: