Intro Thoughts
Status Quo
library(tidyverse)
ed <- rstudioapi::getSourceEditorContext()
source <- ed$contents
tmp <- tempfile()
writeLines(source, tmp)
lightparser::split_to_tbl(tmp) %>%
filter(label == "lightparse_test") %>%
pull(code) %>% .[[1]] %>%
as.vector()
## It seems you are currently knitting a Rmd/Qmd file. The parsing of the file will be done in a new R session.
## [1] "library(tidyverse)"
## [2] ""
## [3] "ed <- rstudioapi::getSourceEditorContext()"
## [4] "source <- ed$contents"
## [5] ""
## [6] "tmp <- tempfile()"
## [7] "writeLines(source, tmp)"
## [8] ""
## [9] "lightparser::split_to_tbl(tmp) %>% "
## [10] " filter(label == \"lightparse_test\") %>% "
## [11] " pull(code) %>% .[[1]] %>% "
## [12] " as.vector()"
## [13] ""
Experiment