Helper function to find the roots of absolute paths. Tries to put absolute paths into the context of the relative root. For those that this is not possible (because they are not in fact a sub-path of the relative roots), identifies the greatest common denominator for absolute paths as their root. Does not change relative paths but does check wheter they do exist if check_existence = TRUE (the default). To modify relative paths, use iso_shorten_relative_paths prior to calling this function.

iso_find_absolute_path_roots(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