library(fs)
library(withr)
with_tempdir({
## create 'src' directory
dir_create("src")
## put an R script containing a call to
## 'cmd_assign' in the 'src' directory
writeLines(c("cmd_assign(x = 1, .out = 'out/results.rds')",
"results <- x + 1",
"saveRDS(results, file = .out)"),
con = "src/results.R")
## call 'extract_make()'
extract_make(path_file = "src/results.R",
dir_make = ".")
})
Run the code above in your browser using DataLab