simplifyPath | R Documentation |
This is a basic function that removes relative
navigation within a directory path.
In other words, it attempts to resolve
..
and .
.
Note that the function does not currently
do extensive checking that the result makes
sense. To truly do this and to take account of symbolic links, etc.,
we need to check via the operating system.
We also don't worry about drive names (e.g. C:
, F:
) on Windows systems.
simplifyPath(path, sep = "/")
path |
the vector of path strings to simplify. |
sep |
the directory separator.
Since this is used for URIs, we use / as the default.
We could use |
A character vector with as many elements.
Duncan Temple Lang <duncan@wald.ucdavis.edu>
mergeURI
dirname
## Not run:
simplifyPath("/ab/cdef/ghi")
simplifyPath("/ab/cdef/ghi/..")
simplifyPath("/ab/cdef/../ghi/..")
simplifyPath("./ab/cdef/ghi/..") # "ab/cdef"
simplifyPath("./ab/") # "ab"
simplifyPath("/xyz/./ab/") # "xyz/ab"
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.