is_sub_path | R Documentation |
Check if the path starts with the dir path.
is_sub_path(x, dir, n = nchar(dir))
x |
A vector of paths. |
dir |
A vector of directory paths. |
n |
The length of |
A logical vector.
You may want to normalize the values of the x
and dir
arguments
first (with normalize_path()
), to make sure the path separators
are consistent.
xfun::is_sub_path("a/b/c.txt", "a/b") # TRUE
xfun::is_sub_path("a/b/c.txt", "d/b") # FALSE
xfun::is_sub_path("a/b/c.txt", "a\\b") # FALSE (even on Windows)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.