validFCTs: Check argument in functions

validFCTsR Documentation

Check argument in functions

Description

Check the validity of the arguments in functions

Usage

validCharacter(
  value1,
  name1 = as.character(substitute(value1)),
  valid.length,
  valid.values = "character",
  refuse.NULL = TRUE,
  refuse.duplicates = FALSE,
  method = NULL,
  addPP = TRUE
)

validPath(
  value1,
  name1 = as.character(substitute(value1)),
  type,
  method = NULL,
  addPP = TRUE,
  extension = NULL,
  check.fsep = FALSE
)

Arguments

value1

the value of the (first) argument to be checked

name1

the name of the (first) argument.

valid.length

the acceptable length(s) for the argument. If NULL no test is performed.

valid.values

the acceptable value(s) for the argument. If NULL no test is performed. Can also be "character" or "character_or_logical".

refuse.NULL

should an error be output if value is NULL.

refuse.duplicates

should an error be output if value contains duplicated values.

method

the name of the function using the argument.

addPP

add ": " after the name of the function in the error message.

type

Either "dir" or "file" to check whether to path points to an existing directory or file.

extension

filter the files by the type of extention.

check.fsep

display a warning when the separator is not correctly specified.

Value

An invisible TRUE or an error message.


bozenne/butils.base documentation built on May 13, 2024, 12:20 p.m.