R/paths.R
from_root.Rd
First compose an absolute path using the project root directory and the
relative path components, i.e., file.path
(root, ...)
. Then
convert it to a relative path with relative_path()
, which is
relative to the current working directory.
from_root(..., root = proj_root(), error = TRUE)
A relative path, or an error when the project root directory cannot
be determined or the conversion failed and error = TRUE
.
This function was inspired by here::here()
, and the major difference
is that it returns a relative path by default, which is more portable.
if (FALSE) { # \dontrun{
xfun::from_root("data", "mtcars.csv")
} # }