Code Storage and Execution Class for 'teal' Applications

Introduction of 'qenv' S4 class, that facilitates code execution and reproducibility in 'teal' applications.


teal.code

CRAN Version Total Downloads Last Month Downloads Last Week Downloads

Check 🛠 Docs 📚 Code Coverage 📔

GitHub forks GitHub repo stars

GitHub commit activity GitHub contributors GitHub last commit GitHub pull requests GitHub repo size GitHub language count Project Status: Active – The project has reached a stable, usable state and is being actively developed. Current Version Open Issues

Overview

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

  • the qenv class for tracking code and storing variables that integrates well with shiny reactive expressions for use in shiny applications whose outputs require reproducibility (i.e. the code used in the application can be retrieved and rerun)
  • ability to chain and join qenv objects together to provide fine-grained control over executed code
  • automatic handling of errors and warnings encountered when executed code

Installation

# stable versions
install.packages('teal.code')

Alternatively, you might want to use the development version.

# install.packages("pak")
pak::pak("insightsengineering/teal.code")

Usage

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

library(teal.code)
my_qenv <- eval_code(qenv(), "x <- 5")
my_qenv
#> <environment: 0x00000225cc85c7a0> [L]
#> Parent: <environment: package:teal.code>
#> Bindings:
#> • x: <dbl> [L]
as.environment(my_qenv)
#> <environment: 0x00000225cc85c7a0>
names(my_qenv)
#> [1] "x"
qenv_2 <- eval_code(my_qenv, "y <- x * 2")
qenv_2 <- eval_code(qenv_2, "z <- y * 2")
qenv_2
#> <environment: 0x00000225ca866d68> [L]
#> Parent: <environment: package:teal.code>
#> Bindings:
#> • x: <dbl> [L]
#> • y: <dbl> [L]
#> • z: <dbl> [L]
environment(qenv_2)
#> <environment: 0x00000225ca866d68>
names(qenv_2)
#> [1] "x" "y" "z"
qenv_2[["y"]]
#> [1] 10
cat(get_code(qenv_2))
#> x <- 5
#> y <- x * 2
#> z <- y * 2

Getting help

If you encounter a bug or have a feature request, please file an issue. For questions, discussions, and updates, use the teal channel in the pharmaverse slack workspace.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("teal.code")

0.7.2 by Dony Unardi, 4 months ago


https://insightsengineering.github.io/teal.code/, https://github.com/insightsengineering/teal.code


Report a bug at https://github.com/insightsengineering/teal.code/issues


Browse source code at https://github.com/cran/teal.code


Authors: Dawid Kaledkowski [aut] , Aleksander Chlebowski [aut] , Marcin Kosinski [aut] , Pawel Rucki [aut] , Nikolas Burkoff [aut] , Mahmoud Hallal [aut] , Maciej Nasinski [aut] , Konrad Pagacz [aut] , Junlue Zhao [aut] , Chendi Liao [rev] , Dony Unardi [rev, cre] , F. Hoffmann-La Roche AG [cph, fnd]


Documentation:   PDF Manual  


Apache License 2.0 license


Imports checkmate, cli, evaluate, grDevices, lifecycle, rlang, stats, utils

Depends on methods

Suggests knitr, rmarkdown, shiny, testthat, withr


Imported by teal, teal.modules.clinical, teal.modules.general, teal.picks, teal.reporter, uteals.

Depended on by teal.data.


See at CRAN