Component-class: Abstract class for a component. Provides basic functions like...

Description Methods

Description

Abstract class for a component. Provides basic functions like logging, working with environment and error handling

Methods

empty(obj)

Verify that a value is empty

Parameters

  • obj Character or number or vector of those.

Return Value

TRUE if the value is empty (array or string)

getEnv(name)

Get system environment variable

Parameters

  • name Name of the environment variable.

Return Value

Value of the environment variable or null if it does not exist.

initialize(debugMode = FALSE)

Constructor.

Parameters

  • debugMode Set higher logging level so that debug messages are printed.

logDebug(obj)

Log a debugging message.

Parameters

  • obj Arbitrary message or printable object.

Return Value

NULL

logError(obj)

Log an error message.

Parameters

  • obj Arbitrary message or printable object.

Return Value

NULL

logInfo(obj)

Log an informational message.

Parameters

  • obj Arbitrary message or printable object.

Return Value

NULL

logWarning(obj)

Log a warning message.

Parameters

  • obj Arbitrary message or printable object.

Return Value

NULL

printLog(msg, mode = "stdout")

Helper function to print timestamp with each message.

Parameters

  • msg Arbitrary message or printable object.

  • mode Logging mode either stdout or stderr.

Return Value

NULL

setDebugMode(debugMode)

Change debugging mode.

Parameters

  • debugMode TRUE to turn debugging on.

Return Value

New debugMode

splitString(string, splitChar, asLogical = FALSE)

Split a string by a specificed split character.

Parameters

  • string Arbitrary string.

  • splitChar Split character.

  • asLogical If TRUE than a vector of TRUEs indexed by token name will be returned if FALSE (default) then a vector of tokens will be returned.

Return Value

Vector of tokens

wrapTryCatch(expr, silentSuccess = FALSE, stopIsFatal = TRUE)

Error handling wrapper which prints Java like stack trace in case of error. Comes from http://stackoverflow.com/a/24884348/41640

Parameters

  • expr An expression to execute.

  • silentSuccess In case of success, do not print any messages.

  • stopIsFatal In case of error, do stop the script execution.

Return Value

NULL


keboola/r-docker-application documentation built on May 20, 2019, 8:34 a.m.