Description Usage Arguments Examples
View source: R/remove_common_root.R
Remove the Common Root Parts
1 | remove_common_root(x, n_keep = 1L, dbg = TRUE)
|
x |
list of vectors of character as returned by
|
n_keep |
minimum number of segments to be kept in any case in the
returned relative paths. For example, two paths "a" and "a/b" have the
common root "a". Removing this root would result in relative paths
"" and "b". As this is not useful, |
dbg |
if |
1 2 3 4 5 6 7 8 9 | # Split paths at the slashes
absparts <- strsplit(c("a/b/c", "a/b/d", "a/b/e/f/g", "a/b/hi"), "/")
# Remove the common parts of the paths
relparts <- remove_common_root(absparts)
relparts
# The extracted root is returned in attribute "root"
attr(relparts, "root")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.