Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

opttest

Optionally test code depending on environment variable.


Description

A convenience wrapper to run code based on whether an environment variable is defined.

Usage

opttest(
  expr,
  testname = NULL,
  testvar = "ENABLE_statnet_TESTS",
  yesvals = c("y", "yes", "t", "true", "1"),
  lowercase = TRUE
)

Arguments

expr

An expression to be evaluated only if testvar is set to a non-empty value.

testname

Optional name of the test. If given, and the test is skipped, will print a message to that end, including the name of the test, and instructions on how to enable it.

testvar

Environment variable name. If set to one of the yesvals, expr is run. Otherwise, an optional message is printed.

yesvals

A character vector of strings considered affirmative values for testvar.

lowercase

Whether to convert the value of testvar to lower case before comparing it to yesvals.


statnet.common

Common R Scripts and Utilities Used by the Statnet Project Software

v4.4.1
GPL-3 + file LICENSE
Authors
Pavel N. Krivitsky [aut, cre] (<https://orcid.org/0000-0002-9101-3362>), Skye Bender-deMoll [ctb]
Initial release
2020-10-03

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.