Open
Description
Feature description
Extend within.qenv(data, expr, links_to = NULL, ...)
so that links_to
parameter will hint the code parser
The goal is that all the code in expr is hinted to one dataname (?or more?).
The get_code
below would output the same code.
library(teal.code)
library(teal.data)
data_within <- teal_data() |> within({
options("AN_OPTION" = iris)
IRIS <- getOption("AN_OPTION")
}, links_to = "IRIS")
datanames(data_within) <- "IRIS"
get_code(data_within, datanames = "IRIS") |> cat()
#> IRIS <- getOption("AN_OPTION")
data_eval <- teal_data() |> eval_code("
options(\"AN_OPTION\" = iris) # @linksto IRIS
IRIS <- getOption(\"AN_OPTION\")
")
datanames(data_eval) <- "IRIS"
get_code(data_eval, datanames = "IRIS") |> cat()
#> options(AN_OPTION = iris)
#> IRIS <- getOption("AN_OPTION")
Created on 2024-02-20 with reprex v2.0.2
Code of Conduct
- I agree to follow this project's Code of Conduct.
Contribution Guidelines
- I agree to follow this project's Contribution Guidelines.
Security Policy
- I agree to follow this project's Security Policy.