Generic abstract class for an application. Provides basic functions like logging, working with environment and error handling
empty(obj)Verify that a value is empty
obj Character or number or vector of those.
TRUE if the value is empty (array or string)
getEnv(name)Get system environment variable
name Name of the environment variable.
Value of the environment variable or null if it does not exist.
initialize(debugMode = FALSE)Constructor.
debugMode Set higher logging level so that debug messages are printed.
logDebug(obj)Log a debugging message.
obj Arbitrary message or printable object.
NULL
logError(obj)Log an error message.
obj Arbitrary message or printable object.
NULL
logInfo(obj)Log an informational message.
obj Arbitrary message or printable object.
NULL
logWarning(obj)Log a warning message.
obj Arbitrary message or printable object.
NULL
printLog(msg, mode = "stdout")Helper function to print timestamp with each message.
msg Arbitrary message or printable object.
mode Logging mode either stdout or stderr.
NULL
run()Main application function, this should be overriden in child class.
NULL
setDebugMode(debugMode)Change debugging mode.
debugMode TRUE to turn debugging on.
New debugMode
splitString(string, splitChar, asLogical = FALSE)Split a string by a specificed split character.
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.
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
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.
NULL
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.