Referencing the current object or current file
For many plugins it is desirable to work on the “current” object. For instance a “sort” plugin could pre-select the data.frame that is currently being edited for sorting. The name of the current object is available to plugins as a pre-defined property called current_object
. You can connect to this property in the usual way. If no object is current, the property equates to an empty string. Similarly, the URL of the current script file
is accessible as a pre-defined property called current_filename
. That property is empty if no script file is currently being edited, or the script file has not been saved, yet.
Currently the current_object
can only be of class data.frame
, but please do not rely on this, since this will be extended to other types of data in the future. If you are interested in data.frame
objects, only, connect to the current_dataframe
property, instead. Alternatively, you can enforce type requirements by using appropriate constraints on your <varslot>s, or by using GUI logic scripting.