Description Usage Arguments Value Note Examples
Gets the parent directory of the input.
1 | parent_dir(x = ".", sep = c("/", "\\"))
|
x |
A character vector of file paths. |
sep |
String separator between directory levels in the output. |
A character vector of parent directories of the input.
Missing values are returned as missing. On Windows, the parent of a
drive, e.g., "c:/"
is itself. Likewise, under Unix, the parent of
"/"
is itself.
1 2 3 4 5 6 7 8 9 10 11 | (x <- c(
sys_which("R"),
r_home(),
r_profile_site(),
"c:/", # different behaviour under Windows/Unix
"~",
"/",
"foo/bar/nonexistent",
NA
))
parent_dir(x)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.