-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow non-standard datanames in code dependency (#340)
# Pull Request <!--- Replace `#nnn` with your issue link for reference. --> Fixes insightsengineering/teal#1366 Related: - insightsengineering/teal#1382 - insightsengineering/teal.slice#622 - #340 ### Changes description - [x] Adds support for non-standard names in code dependency - [x] Support backtick symbols in code dependency <details> <summary>Reproducible code for backtick support in code parser</summary> `%add_column%` definition is not detected ```r pkgload::load_all("teal.data") #> ℹ Loading teal.data #> Loading required package: teal.code td <- teal_data() |> within({ IRIS <- iris IRIS2 <- iris MTCARS <- mtcars `%add_column%` <- function(lhs, rhs) dplyr::bind_cols(lhs, rhs) # @ add_column <- function(lhs, rhs) dplyr::bind_cols(lhs, rhs) IRIS <- IRIS %add_column% dplyr::tibble(yada = IRIS2$Species) IRIS <- add_column(IRIS, dplyr::tibble(yada2 = IRIS2$Species)) }) td |> get_code(datanames = "IRIS") |> cat() #> IRIS <- iris #> IRIS2 <- iris #> add_column <- function(lhs, rhs) dplyr::bind_cols(lhs, rhs) #> IRIS <- IRIS %add_column% dplyr::tibble(yada = IRIS2$Species) #> IRIS <- add_column(IRIS, dplyr::tibble(yada2 = IRIS2$Species)) td2 <- td |> within({ IRIS <- `%add_column%`(IRIS, dplyr::tibble(yada2 = IRIS2$Species)) }) td2 |> get_code(datanames = "IRIS") |> cat() #> IRIS <- iris #> IRIS2 <- iris #> add_column <- function(lhs, rhs) dplyr::bind_cols(lhs, rhs) #> IRIS <- IRIS %add_column% dplyr::tibble(yada = IRIS2$Species) #> IRIS <- add_column(IRIS, dplyr::tibble(yada2 = IRIS2$Species)) #> IRIS <- IRIS %add_column% dplyr::tibble(yada2 = IRIS2$Species) ``` <sup>Created on 2024-10-15 with [reprex v2.1.1](https://reprex.tidyverse.org)</sup> </details> --------- Co-authored-by: 27856297+dependabot-preview[bot]@users.noreply.github.com <27856297+dependabot-preview[bot]@users.noreply.github.com>
- Loading branch information
1 parent
b5ccb1d
commit fcad956
Showing
3 changed files
with
158 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters