From a79718434c940d125400db8d3faf62a43a79dd0a Mon Sep 17 00:00:00 2001 From: richardreeve Date: Wed, 7 Dec 2022 14:10:03 +0000 Subject: [PATCH] Mention assert_no_globals() --- DESCRIPTION | 2 +- inst/tutorials/practical3-1/practical3-1.Rmd | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index bd7850c8..8ed14602 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: RPiR Type: Package Title: Reproducible Programming in R -Version: 0.76.21 +Version: 0.76.22 Authors@R: c(person("Sonia", "Mitchell", email = "sonia.mitchell@glasgow.ac.uk", role = c("aut"), comment = c(ORCID = "0000-0003-1536-2066")), diff --git a/inst/tutorials/practical3-1/practical3-1.Rmd b/inst/tutorials/practical3-1/practical3-1.Rmd index 4cbfea17..cbae19df 100644 --- a/inst/tutorials/practical3-1/practical3-1.Rmd +++ b/inst/tutorials/practical3-1/practical3-1.Rmd @@ -447,7 +447,22 @@ For Practical 3-2 you'll need to add a function called with appropriate documentation. Copy the step_deterministic_birth_death function for the time being, renamed of course. You'll be using this as a starting point in -Practical 3-2. +Practical 3-2. You can also add a check that the functions use no +global variables to the function definitions by adding a check at +the bottom of the file after the end of the function.: + +```{r, eval = FALSE} +} + +# Check for global variables +RPiR::assert_no_globals(timestep_stochastic_birth_death) +``` + +We've provided a new function in the RPiR package to do the checking for +you (`assert_no_globals()`) to make this simpler than it was in Series 2. +You can just type `assert_no_globals` without the brackets to read the function +definition and see that it is very similar to the code snippet we got you to +use before. ### 2. Add a demo Now create a new R script called