insightsengineering / insightsengineering/teal.code
[Feature Request]: Extend `within` to accept a custom parameter that links all lines to a dataname
Nessuno ha ancora preso questa issue.
- Lingua principale
- R
- Stelle
- 12
- Fork
- 11
- Merge medio
- 1g 17h
- PR unite (30g)
- 1
Descrizione
### 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.
``` r
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](https://reprex.tidyverse.org)
### Code of Conduct
- [X] I agree to follow this project's Code of Conduct.
### Contribution Guidelines
- [X] I agree to follow this project's Contribution Guidelines.
### Security Policy
- [X] I agree to follow this project's Security Policy.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia tracciando il punto di ingresso within.qenv e confrontando il suo output di get_code con il comportamento @linksto esistente di eval_code. Il lavoro è completato quando un valore links_to in within.qenv collega il codice expr pertinente al dataname specificato e preserva il risultato get_code mostrato; l’issue non indica file né test.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- r
- Ambito
- tooling
- Tipo di issue
- Funzionalità
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100