Function to root both relative and absolute paths to a root directory (or directories) commonly relative to current working directory. Determines the best way to shorten relative paths and put absolute paths in a relative context (if possible) using iso_shorten_relative_paths and iso_find_absolute_path_roots, respectively.

iso_root_paths(path, root = ".", check_existence = TRUE)

Arguments

path

vector of file/folder paths, mixed relative and absolute paths are allowed.

root

root for relative paths. Can be relative to the current working directory (e.g. "data") or an absolute path on the file system (e.g. "/Users/..." or "C:/Data/.."). The default is the current working directory ("."). Can be supplied as a vector of same length as the provided paths if the paths have different roots.

check_existence

whether to check for the existence of the paths

Value

a data frame with the root directories and paths relative to the root - order of input paths is preserved

See also