FILE.R <- tempfile(fileext = ".R")
this.path:::.write.code({
this.path::here()
this.path::here(.. = 1)
this.path::here(.. = 2)
## use 'here' to read input from a file located nearby
this.path::here(.. = 1, "input", "file1.csv")
## or maybe to run another script
this.path::here("script2.R")
}, FILE.R)
source(FILE.R, echo = TRUE, verbose = FALSE)
unlink(FILE.R)
Run the code above in your browser using DataLab