Skip to contents

CRAN Version Total Downloads Last Month Downloads Last Week Downloads

Check 🛠 Docs 📚 Code Coverage 📔

GitHub forksGitHub repo stars

GitHub commit activityGitHub contributorsGitHub last commitGitHub pull requestsGitHub repo sizeGitHub language countProject Status: Active – The project has reached a stable, usable state and is being actively developed. Current Version Open Issues


teal.code is an R library providing tools to store code and an execution environment associated with it. The features include:

  • an object qenv for storing code and an execution environment which integrates well with shiny reactives for use in shiny applications whose outputs require reproducibility (i.e. the code used to generate them)
  • ability to chain and join qenv objects together to provide fine-grained control over executed code
  • automatic error and warning handling for executed code

teal.code also ships a shiny module that helps inspect the stored code as well as messages, warnings and error messages resulting from evaluation via shiny web application.


From July 2023 insightsengineering packages are available on r-universe.

# stable versions
install.packages('teal.code', repos = c('', ''))

# install.packages("pak")

Alternatively, you might also use the development version.

# beta versions
install.packages('teal.code', repos = c('', ''))

# install.packages("pak")


To understand how to use this package, please refer to the Getting Started article, which provides multiple examples of code implementation.

Below is the showcase of the example usage

my_qenv <- new_qenv(env = list2env(list(x = 5)), code = "x <- 5")
#> Parent: <environment: package:teal.code>
#> Bindings:
#> • x: <dbl> [L]
qenv_2 <- eval_code(my_qenv, "y <- x * 2") |> eval_code("z <- y * 2")
#> <environment: 0x00000135b544cfe8> [L]
#> Parent: <environment: package:teal.code>
#> Bindings:
#> • x: <dbl> [L]
#> • y: <dbl> [L]
#> • z: <dbl> [L]
#> [1] 10
cat(paste(get_code(qenv_2), collapse = "\n"))
#> x <- 5
#> y <- x * 2
#> z <- y * 2

Getting help

If you encounter a bug or you have a feature request - please file an issue. For questions, discussions and staying up to date, please use the “teal” channel in the pharmaverse slack workspace.

Stargazers and Forkers

Stargazers over time

Stargazers over time


Stargazers repo roster for @insightsengineering/teal.code


Forkers repo roster for @insightsengineering/teal.code