Get the parent dir
Gets the parent directory of the input.
parent_dir(x = ".", sep = c("/", "\\"))
- A character vector of file paths.
- 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
"c:/" is itself. Likewise, under Unix, the parent of
"/" is itself.
(x <- c( sys_which("R"), r_home(), r_profile_site(), "c:/", # different behaviour under Windows/Unix "~", "/", "foo/bar/nonexistent", NA )) parent_dir(x)
Looks like there are no examples yet.