insightsengineering / insightsengineering/teal.code

qenv.error: cannot add bindings to a locked environment when evaluating qenv code:

Open
#178 0 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.