## ----setup, include = FALSE--------------------------------------------------- knitr::opts_chunk$set( collapse = TRUE, comment = "#>", eval = FALSE ) library(toolero) ## ----------------------------------------------------------------------------- # library(toolero) # # context <- detect_execution_context() # context # #> [1] "interactive" ## ----------------------------------------------------------------------------- # context <- detect_execution_context() # # input_file <- switch(context, # interactive = "data/input.csv", # quarto = params$input_file, # rscript = commandArgs(trailingOnly = TRUE)[1] # ) ## ----------------------------------------------------------------------------- # data <- readr::read_csv("data/penguins.csv") ## ----------------------------------------------------------------------------- # library(toolero) # # context <- detect_execution_context() # # input_file <- switch(context, # interactive = "data/penguins.csv", # quarto = params$input_file, # rscript = commandArgs(trailingOnly = TRUE)[1] # ) # # data <- read_clean_csv(input_file) ## ----------------------------------------------------------------------------- # # Scaffold a new document with context-aware input resolution built in # create_qmd(path = ".", filename = "analysis.qmd") ## ----------------------------------------------------------------------------- # qmd_to_r( # input = "analysis.qmd", # output = "scripts/analysis.R" # )