parent_dir

0th

Percentile

Get the parent dir

Gets the parent directory of the input.

Usage
parent_dir(x = ".", sep = c("/", "\\"))
Arguments
x
A character vector of file paths.
sep
String separator between directory levels in the output.
Value

A character vector of parent directories of the input.

Note

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.

Aliases
  • parent_dir
Examples
(x <- c(
  sys_which("R"),
  r_home(),
  r_profile_site(),
  "c:/",  # different behaviour under Windows/Unix
  "~",
  "/",
  "foo/bar/nonexistent",
  NA
))
parent_dir(x)
Documentation reproduced from package pathological, version 0.1-1, License: Unlimited

Community examples

Looks like there are no examples yet.