is_windows_drive

0th

Percentile

Is the path a Windows drive?

Checks to see if the path is a Windows drive.

Usage
is_windows_drive(x)
Arguments
x
A character vector of file paths. Defaults to files in the current directory.
Value

A logical vector, TRUE when the path is a Windows drive name. On non-Windows machines, the return value is FALSE everywhere.

Note

The check is done by regular expression: values are considered to be Windows drive name if they consist of a letter followed by a colon, optionally followed by a slash or backslash. Paths are standardardized before checking, so . and .. are resolved to their actual locations rather than always returning FALSE.

See Also

get_drive

Aliases
  • is_windows_drive
Examples
x <- c("c:", "c:/", "c:\\", "C:", "C:/", "C:\\", "c:/c", "cc:", NA)
# Warnings about OS suppressed so package checks pass on non-Windows systems.
suppressWarnings(is_windows_drive(x))
Documentation reproduced from package pathological, version 0.1-1, License: Unlimited

Community examples

Looks like there are no examples yet.