Learn R Programming

toscutil (version 2.8.0)

getfd: Get File Directory

Description

Return full path to current file directory

Usage

getfd(
  on.error = stop("No file sourced. Maybe you're in an interactive shell?", call. =
    FALSE),
  winslash = "/"
)

Value

Current file directory as string

Arguments

on.error

Expression to use if the current file directory cannot be determined. In that case, normalizePath(on.error, winslash) is returned. Can also be an expression like stop("message") to stop execution (default).

winslash

Path separator to use for windows

Examples

Run this code
getfd(on.error = getwd())
if (FALSE) {
getfd()
}

Run the code above in your browser using DataLab