Description Usage Arguments Value See Also Examples
Convenience function to shorten relative paths based on overlap with the provided root(s). Also simplifies current directory repeats (e.g. "././." becomes ".") for better legibility. Does not check whether the original or resulting paths point to valid files or folders. Relative paths that do not start with the supplied root
default back to the current working directory (.
). Absolute paths are allowed but are returned as is without attempts at shortening. See iso_find_absolute_path_roots
for rooting absolute paths.
1 | iso_shorten_relative_paths(path, root = ".")
|
path |
vector of file/folder paths, mixed relative and absolute paths are allowed. |
root |
root directory for the isofiles. Can be relative to the current working directory (e.g. |
a data frame with the root directories and paths relative to the root - order of input paths is preserved
Other file system functions:
iso_expand_paths()
,
iso_find_absolute_path_roots()
,
iso_root_paths()
1 2 3 4 | iso_shorten_relative_paths(file.path("A", "B", "C"), "A") # root = "A", path = B/C
iso_shorten_relative_paths(file.path("A", "B", "C"), file.path("A", "B")) # root = "A/B", path = "C"
iso_shorten_relative_paths(file.path("A", "C", "D"), file.path("A", "B")) # root = "A", path = "C/D"
iso_shorten_relative_paths(file.path("A", "B", "C"), "B") # root = ".", path stays "A/B/C"
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.