feedback: Function to feedback messages either to the user and/or to...

Description Usage Arguments Value Examples

View source: R/feedback.R

Description

This function provides the functionality to publish any kind of information to the user, the console and/or to the logfile. This might be a simple info, a warning or an error. The function can be used to select the output (console, ui, logfile). If no output is selected, the print_this string will be printed to the console and to logfile. One of these must be a string with length > 0: print_me, console, ui

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
feedback(
  print_this = "",
  type = "Info",
  ui = FALSE,
  console = TRUE,
  logfile = TRUE,
  logjs = FALSE,
  prefix = "",
  suffix = "",
  findme = "",
  logfile_dir = tempdir(),
  headless = TRUE
)

Arguments

print_this

(Optional, String, default: "")

type

(Optional, String, default: "Info") E.g. "Warning", "Error. Default: "Info"

ui

(Optional, Boolean/String, default: FALSE) If true, the message will also be printed to the user in form of a modal. Can also be a string.

console

(Optional, Boolean/String, default: TRUE) If true, the message will also be printed to the console as is. Can also be a string.

logfile

(Optional, Boolean, default: TRUE) If true (default) the print_this string will also be printed to the console.

logjs

(Optional, Boolean, default: FALSE) If true (default: false) the print_this string will also be printed to the javascript-console. This only makes sense, if the gui is active.

prefix

Prefix (Optional, String, default: "") This is useful if print_this is an array/list. Each entry will then be new row with this prefix.

suffix

Suffix (Optional, String, default: "") Same like prefix but at the end of each line.

findme

(Optional, String, default: "") Recommended with length 10. String to find the message in the code. E.g. 10-digit random hex from (<https://www.browserling.com/tools/random-hex>) or (<https://onlinerandomtools.com/generate-random-hexadecimal-numbers>)

logfile_dir

(Optional, String, default: "tempdir()") The absolute path to folder where the logfile will be stored.

headless

(Optional, Boolean, default: TRUE) Indicating, if the function is run only in the console (headless = TRUE) or on a GUI frontend (headless = FALSE).

Value

No return value, called for publishing a message.

Examples

1
2
3
4
5
6
7
feedback(
  print_this = "Error occured when counting source_data",
  type = "Error",
  findme = "255bb3695c",
  logfile_dir = tempdir(),
  headless = TRUE
)

miracum/misc-dizutils documentation built on Nov. 21, 2020, 7:41 p.m.