Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
210 bring
get_code_dependency
(#214)
BLOCKED by - insightsengineering/teal.data#340 Closes - #210 Companion to - insightsengineering/teal.data#343 - insightsengineering/teal#1388 # Description Brings `names` parameter to `get_code` so that you can limit returned code to specific objects (and the lines that create those objects). `get_code_dependency` was moved from `teal.data` # Tested with ``` r library(teal.code) # EVAL CODE q <- qenv() q <- eval_code(q, code = c("a <- 1", "b <- 2")) q@code #> [1] "a <- 1\nb <- 2" get_code(q, names = "a") #> [1] "a <- 1" # WITHIN q <- qenv() q <- within(q, {a <- 1; b <- 2}) q@code #> [1] "a <- 1\nb <- 2" get_code(q, names = "a") #> [1] "a <- 1" # OLD TEAL.DATA t <- teal.data::teal_data(a = 5, code = c("a <- 1", "b <- 2")) t@code #> [1] "a <- 1\nb <- 2" teal.data::get_code(t, datanames = 'a') #> Warning in .local(object, deparse, ...): get_code(datanames) was deprecated in #> teal.data 0.6.1, use get_code(names) instead. #> [1] "a <- 1" ``` <sup>Created on 2024-10-16 with [reprex v2.1.1](https://reprex.tidyverse.org)</sup> # Local tests ```r > devtools::test() ℹ Testing teal.code ✔ | F W S OK | Context ✔ | 12 | qenv_concat ✔ | 8 | qenv_constructor ✔ | 26 | qenv_eval_code ✔ | 2 60 | qenv_get_code [1.1s] ✔ | 10 | qenv_get_var ✔ | 7 | qenv_get_warnings ✔ | 40 | qenv_join ✔ | 14 | qenv_within ✔ | 12 | utils ══ Results ══════════════════════════════════════════════════════════════════ Duration: 2.2 s ── Skipped tests (2) ──────────────────────────────────────────────────────── • This is not urgent and can be ommitted with @linksto tag. (1): test-qenv_get_code.R:526:3 • We will not resolve this, as this requires code evaluation. (1): test-qenv_get_code.R:318:3 [ FAIL 0 | WARN 0 | SKIP 2 | PASS 189 ] ```` # Local R CMD CHECK ```r ── R CMD check results ──────────────────────────────────── teal.code 0.5.0.9010 ──── Duration: 33.5s ❯ checking for future file timestamps ... NOTE unable to verify current time 0 errors ✔ | 0 warnings ✔ | 1 note ✖ R CMD check succeeded ``` --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: 27856297+dependabot-preview[bot]@users.noreply.github.com <27856297+dependabot-preview[bot]@users.noreply.github.com>
- Loading branch information