FILE <- 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)
source(FILE, echo = TRUE, verbose = FALSE)
unlink(FILE)
Run the code above in your browser using DataLab