here {this.path} | R Documentation |
this.dir()
Construct the path to a file from components in a platform-independent way,
starting with this.dir()
.
here(..., .. = 0)
ici(..., .. = 0)
... |
further arguments passed to |
.. |
the number of directories to go back. |
The path to a file begins with a base. The base is ..
number of
directories back from the executing script's directory (this.dir()
). The
argument is named ..
because ".."
refers to the parent directory
in Windows, Unix, and URL paths alike.
A character vector of the arguments concatenated term-by-term, beginning with the executing script's directory.
this.path:::write.code(file = FILE <- tempfile(), {
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")
})
source(FILE, echo = TRUE, verbose = FALSE)