[rkward-cvs] SF.net SVN: rkward:[2917] trunk/rkward/doc/rkward/ writing_plugins_introduction.docbook
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Wed Jun 30 15:33:05 UTC 2010
Revision: 2917
http://rkward.svn.sourceforge.net/rkward/?rev=2917&view=rev
Author: tfry
Date: 2010-06-30 15:33:05 +0000 (Wed, 30 Jun 2010)
Log Message:
-----------
Change instructions on assigning to globalenv to match current best practice.
Modified Paths:
--------------
trunk/rkward/doc/rkward/writing_plugins_introduction.docbook
Modified: trunk/rkward/doc/rkward/writing_plugins_introduction.docbook
===================================================================
--- trunk/rkward/doc/rkward/writing_plugins_introduction.docbook 2010-06-30 15:31:33 UTC (rev 2916)
+++ trunk/rkward/doc/rkward/writing_plugins_introduction.docbook 2010-06-30 15:33:05 UTC (rev 2917)
@@ -512,7 +512,7 @@
More often than not you will have to create one or more temporary R objects in the code generated by your plugin. Normally, you do not want those to be placed in the user's workspace, potentially even overwriting user variables. Hence, all plugin generated code is run in a local() environment (see R help page on function local()). This means, all variables you create are temporary and will not be saved permanently.
</para>
<para>
-If the user explicitely asks for a variable to be saved, you will need to assign to that object with the "<<-" operator.
+If the user explicitely asks for a variable to be saved, you will need to assign to that object using ".GlobalEnv$objectname <- value".
</para>
<para>
One important pitfall is using eval() to evaluate substitutes. Here, you need to note that eval will by default use the current environment for evaluation, i.e. the local one. This will work well most of the times, but if you define any temporary variables in the local environment, and you are trying to fetch user variables of the same name using eval, you will get errors. For example:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the rkward-tracker
mailing list