https://github.com/insightsengineering/teal.code
Code storage and execution class for teal applications
https://github.com/insightsengineering/teal.code
nest r shiny
Last synced: 5 months ago
JSON representation
Code storage and execution class for teal applications
- Host: GitHub
- URL: https://github.com/insightsengineering/teal.code
- Owner: insightsengineering
- License: other
- Created: 2022-03-28T14:16:01.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-02-04T06:55:44.000Z (5 months ago)
- Last Synced: 2025-02-04T07:30:20.648Z (5 months ago)
- Topics: nest, r, shiny
- Language: R
- Homepage: https://insightsengineering.github.io/teal.code/
- Size: 17.2 MB
- Stars: 11
- Watchers: 15
- Forks: 8
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Changelog: NEWS.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
- awesome-shiny-extensions - teal.code - Code storage and execution class for teal applications. (Frameworks / Framework extensions)
README
# teal.code
[](https://cran.r-project.org/package=teal.code)
[](https://cran.r-project.org/package=teal.code)
[](https://cran.r-project.org/package=teal.code)
[](https://cran.r-project.org/package=teal.code)[](https://insightsengineering.github.io/teal.code/main/unit-test-report/)
[](https://insightsengineering.github.io/teal.code/)
[](https://insightsengineering.github.io/teal.code/main/coverage-report/)






[](https://www.repostatus.org/#active)
[](https://github.com/insightsengineering/teal.code/tree/main)
[](https://github.com/insightsengineering/teal.code/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc)## 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
```r
# stable versions
install.packages('teal.code')
```Alternatively, you might want to use the development version.
```r
# install.packages("pak")
pak::pak("insightsengineering/teal.code")
```## Usage
To understand how to use this package, please refer to the [Getting Started](https://insightsengineering.github.io/teal.code/latest-tag/articles/teal-code.html) article, which provides multiple examples of code implementation.
Below is the showcase of the example usage
```r
library(teal.code)
my_qenv <- eval_code(qenv(), "x <- 5")
my_qenv
#> [L]
#> Parent:
#> Bindings:
#> • x: [L]
as.environment(my_qenv)
#>
names(my_qenv)
#> [1] "x"
``````r
qenv_2 <- eval_code(my_qenv, "y <- x * 2")
qenv_2 <- eval_code(qenv_2, "z <- y * 2")
qenv_2
#> [L]
#> Parent:
#> Bindings:
#> • x: [L]
#> • y: [L]
#> • z: [L]
environment(qenv_2)
#>
names(qenv_2)
#> [1] "x" "y" "z"
``````r
qenv_2[["y"]]
#> [1] 10
``````r
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](https://pharmaverse.slack.com).
## Stargazers and Forkers
### Stargazers over time
[](https://starchart.cc/insightsengineering/teal.code)
### Stargazers
[](https://github.com/insightsengineering/teal.code/stargazers)
### Forkers
[](https://github.com/insightsengineering/teal.code/network/members)