Functions available for GUI logic scripting

Class "Component"

Class which represents a single component or component-property. The most important instance of this class is the variable "gui" which is predefined as the root property of the current component. The following methods are available for instances of class "Component":

absoluteId(base_id)

Returns the absolute ID of base_id, or - if base_id is omitted - the identifier of the component.

getValue(id)

Discouraged. Use getString(), getBoolean(), or getList(), instead. Returns the value of the given child property. Returns the value of this property, if ID is omitted.

getString(id)

Returns the value of the given child property as a string. Returns the value of this property, if ID is omitted.

getBoolean(id)

Returns the value of the given child property as a boolean (if possible). Returns the value of this property, if ID is omitted.

getList(id)

Returns the value of the given child property as an array of strings (if possible). Returns the value of this property, if ID is omitted.

setValue(id, value)

Set the value of the given child property to value.

getChild(id)

Return an instance of the child-property with the given id.

addChangeCommand(id, command)

Execute command whenever the child property given by id changes.

Class "RObject"

Class which represents a single R object. An instance of this class can be obtained by using makeRObject(objectname). The following methods are available for instances of class "RObject":

Warning

If any commands are still pending in the backend, the information provided by these methods can be out-of-date by the time that the plugin code is run. Do not rely on it for critical operations (risking loss of data).

getName()

Returns the absolute name of the object.

exists()

Returns whether the object exists. You should generally check this before using any of the methods listed below.

dimensions()

Returns an array of dimensions (similar to dim() in R).

classes()

Returns an array of classes (similar to class() in R).

isClass(class)

Returns true, if the object is of class class.

isDataFrame()

Returns true, if the object is a data.frame.

isMatrix()

Returns true, if the object is a matrix.

isList()

Returns true, if the object is a list.

isFunction()

Returns true, if the object is a function.

isEnvironment()

Returns true, if the object is an environment.

isDataNumeric()

Returns true, if the object is a vector of numeric data.

isDataFactor()

Returns true, if the object is a vector of factor data.

isDataCharacter()

Returns true, if the object is a vector of character data.

isDataLogical()

Returns true, if the object is a vector of logical data.

parent()

Returns an instance of "RObject" representing the parent of this object.

child(childname)

Returns an instance of "RObject" representing the child childname of this object.

Class "RObjectArray"

An array of RObject instances. An instance of this class can be obtained by using makeRObjectArray(objectnames). It is particularly useful when dealing with varslots which allow to select multiple objects.

include()-function

include(filename) can be used to include a separate JS file.

doRCommand()-function

doRCommand(command, callback) can be used to query R for information. Please read the section on querying R from inside a plugin for details, and caveats.