Package 'quietR'

Title: Simplify Output Verbosity
Description: Simplifies output suppression logic in R packages, as it's common to develop some form of it in R. 'quietR' intends to simplify that problem and allow a set of simple toggle functions to be used to suppress console output.
Authors: Thomas Johnson [aut, cre]
Maintainer: Thomas Johnson <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0
Built: 2024-11-23 05:33:43 UTC
Source: https://github.com/thomascjohnson/quietr

Help Index


Output Functions

Description

Masked output functions (cat, message, print) that can be toggled with [verbosity] functions. Instead of implementing your own verbose handling system, use quietR.

Usage

cat(...)

message(...)

print(...)

Arguments

...

Arguments passed to masked output function

Examples

print("Hello World!")
disable_verbose()
print("Hello World!")

Getting and Setting Verbosity

Description

Use the 'is_verbose', 'enable_verbose' and 'disable_verbose' to toggle console output functions.

Usage

enable_cat()

disable_cat()

enable_message()

disable_message()

enable_print()

disable_print()

is_verbose(func = c("print", "cat", "message"))

enable_verbose(func = c("print", "cat", "message"))

disable_verbose(func = c("print", "cat", "message"))

Arguments

func

character - which function(s) to enable

Value

logical, whether or not to output specified function

Examples

# Returns FALSE:
is_verbose("print") #FALSE

enable_verbose()
# Now it returns TRUE:
is_verbose("print") #TRUE

disable_verbose()
# Now it returns FALSE:
is_verbose() #FALSE
is_verbose("print") #FALSE

enable_verbose("print")
print("Hi there!") # Outputs
cat("I won't output") # Doesn't output