Learn R Programming

pathological (version 0.0-3)

get_drive: On Windows, return the drive of the path

Description

On a Windows system, this returns the drive letter of the path followed by a colon. On other systems, it returns a single forward slash.

Usage

get_drive(x = getwd())

Arguments

x
A character vector of file paths. Defaults to the current directory.

Value

  • A character vector of drive paths on Windows systems, or forward slashes on Unix-based systems.

Examples

Run this code
get_drive(c("~", r_home(), temp_dir()))

Run the code above in your browser using DataLab