Application which serves as a backend for LuckyGuess component
checkParam(data, name, dataType, fullName)
Recursive function to check a parameter provided in JSON data.
Note that this function is called for each parameter (name) separately and it
tries to find that name
in the provided data
. It will
return the data possibly with coerced values.
data
JSON parsed data.
name
Name of the parameter, either a string or a vector
of characters if the parameter is nested.
dataType
String name of the R data type required.
fullName
Arbitrary named used for global identification of the parameter.
List with partially modified data.
getCleanData(types, cleanData)
Apply column types detected by LG to a data frame.
types
Data frame with contents of table with LG datatypes
(this table is usually named VAI__1
in SAPI).
cleanData
A data frame with actual data, its columns are
expected to be listed as rows in the types table.
data.frame supplied in cleanData parameter with applied data types.
getConvertedDataType(type, mode)
Convert LG type definition to an R data type.
type
LG data type string (integer
, datetime
, etc.).
mode
LG variable mode (continuous
, discrete
).
String with R data type name
initialize(args = NULL)
Constructor.
args
Optional name of data directory, if not supplied then it
will be read from command line argument or environment KBC_DATADIR.
Response body - either list or string in case the body cannot be parsed as JSON.
installModulePackages(packages = c())
Install and load all required libraries.
packages
Vector of package names.
TRUE
run()
Main application function, this should be overriden in child class.
NULL
saveDataFrame(dataFrame, tableName, rowNumbers = FALSE, incremental = FALSE,
forcedColumnTypes)
Save a dataframe to database using bulk inserts. The table will be created to accomodate to data frame columns.
dataFrame
A data frame, column names of data frame
must correspond to column names of table.
tableName
Name of the table.
rowNumbers
If true then the table will contain a column
named row_num
with sequential row index.
incremental
If true then the table will not be recreated,
only data will be inserted.
TRUE
saveFileName(name, tags)
Save reference to a file.
name
String physical file path.
tags
Character vector of file tags.
TRUE
saveFiles()
Save uploaded files (move them to out directory and create manifests)
TRUE
saveValue(name, value, grouping = 0)
Save an arbitrary simple value.
key
String key name.
value
Arbitrary value.
grouping
Optional grouping of values if they are related.
TRUE
silence(command)
Silence all but error output from a command. Note: this function does nothing if the debugMode variable is set to TRUE.
command
Arbitrary command.
Command return value.
startUp()
Start up the Application, initialize working directory and database tables.
TRUE
validate()
Save uploaded files (move them to out directory and create manifests)
TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.