insightsengineering / insightsengineering/teal.code
qenv.error: cannot add bindings to a locked environment when evaluating qenv code:
Open
bug
core
- Dominant language
- R
- Stars
- 12
- Forks
- 11
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 1
Description
### What happened?
When creating an S4 class inside `eval_code` you get an error that you `cannot add bindings to a locked environment`
```r
library(teal.data)
library(teal.code)
code <- c(
"setClass('aclass', slots = c(a = 'numeric', x = 'numeric', y = 'numeric')) # @linksto a x",
"x <- new('aclass', a = 1:3, x = 1:3, y = 1:3)",
"a <- new('aclass', a = 1:3, x = 1:3, y = 1:3)",
"a@x <- a@y",
"a@x <- a@x + 2",
"a@x <- x@a"
)
tdata <- eval_code(teal_data(), code)
tdata
```
```r
```
Contributor guide
Assessment
This issue has not been assessed yet.