check_dir: Check a directory exists

View source: R/utils.R

check_dirR Documentation

Check a directory exists

Description

This function checks whether a directory exists and, if not, returns an informative error message. The inputted directory can be edited with the addition of a '/' if requested.

Usage

check_dir(arg = deparse(substitute(input)), input, check_slash = FALSE)

Arguments

arg

(optional) A character string which defines the argument of a parent function.

input

A character string which defines a directory.

check_slash

A logical input that defines whether or not to check the end of a string for '/'. If TRUE and a '/' is lacking, this is added to the returned directory.

Value

The function checks whether or not a directory exists. If so, the function returns either the directory as inputted, or the directory with a '/' added to the end. If not, the function returns an informative error message.

Author(s)

Edward Lavender


edwardlavender/fvcom.tbx documentation built on Nov. 26, 2022, 10:28 p.m.