[rkward-cvs] SF.net SVN: rkward: [1640] trunk/rkward/rkward/plugins

tfry at users.sourceforge.net tfry at users.sourceforge.net
Mon Mar 19 19:57:21 UTC 2007


Revision: 1640
          http://svn.sourceforge.net/rkward/?rev=1640&view=rev
Author:   tfry
Date:     2007-03-19 12:57:21 -0700 (Mon, 19 Mar 2007)

Log Message:
-----------
Add help files for load() and source() plugins, and some improvments to those

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/00saveload/import/load_data.php
    trunk/rkward/rkward/plugins/00saveload/import/load_data.xml
    trunk/rkward/rkward/plugins/00saveload/import/source.php
    trunk/rkward/rkward/plugins/00saveload/import/source.xml
    trunk/rkward/rkward/plugins/Makefile.am
    trunk/rkward/rkward/plugins/import_export.pluginmap

Added Paths:
-----------
    trunk/rkward/rkward/plugins/00saveload/import/load_data.rkh
    trunk/rkward/rkward/plugins/00saveload/import/source.rkh

Modified: trunk/rkward/rkward/plugins/00saveload/import/load_data.php
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/import/load_data.php	2007-03-19 18:22:21 UTC (rev 1639)
+++ trunk/rkward/rkward/plugins/00saveload/import/load_data.php	2007-03-19 19:57:21 UTC (rev 1640)
@@ -1,10 +1,19 @@
 <?
 function preprocess () {
 }
-	
+
 function calculate () {
-?>
-load (file="<? getRK("file"); ?>", envir=globalenv())
+	if (getRK_val ("other_env")) {
+		$other_env = true;
+		$envir = getRK_val ("envir");
+	} else {
+		$envir = "globalenv()";
+	}
+
+	if ($other_env) { ?>
+<? echo ($envir); ?> <<- new.env (parent=globalenv())
+<?	} ?>
+load (file="<? getRK("file"); ?>", envir=<? echo ($envir); ?>)
 <?
 }
 

Added: trunk/rkward/rkward/plugins/00saveload/import/load_data.rkh
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/import/load_data.rkh	                        (rev 0)
+++ trunk/rkward/rkward/plugins/00saveload/import/load_data.rkh	2007-03-19 19:57:21 UTC (rev 1640)
@@ -0,0 +1,27 @@
+<!DOCTYPE rkhelp>
+<document>
+	<summary>
+Load an R data file.
+	</summary>
+
+	<usage>
+Chose the R file to import. This would be a file created e.g. by saving the workspace from RKWard, using the R <link href="rkward://rhelp/save">save()</link> command, or the <link href="rkward://component/save_r"/> plugin. The main difference to loading a workspace via Workspace->Open Workspace, is that the workspace is not cleaned, first, but rather merged with your existing workspace. If in doubt, use Workspace->Open Workspace, instead of this plugin.
+
+Be sure to save your workspace before using this plugin, as your variables will be overwritten, if the loaded workspace contains objects of the same names.
+	</usage>
+
+	<settings>
+		<setting id="file">The filename of the file to load</setting>
+		<setting id="other_env">Should the data be loaded into another (specified environment) instead of the global environment?</setting>
+		<setting id="envir">Only applicable, if the above option is checked. Name of the environment to load the data to. If this does not yet exist, it will be created. If it already exists, it will be overwritten completely, i.e. deleting all objects inside it!</setting>
+	</settings>
+	<related>
+		<ul>
+			<li><link href="rkward://component/import_csv"/></li>
+			<li><link href="rkward://component/save_r"/></li>
+			<li><link href="rkward://rhelp/load"/></li>
+			<li><link href="rkward://rhelp/save"/></li>
+			<li><link href="rkward://page/rkward_for_new_users"/></li>
+		</ul>
+	</related>
+</document>

Modified: trunk/rkward/rkward/plugins/00saveload/import/load_data.xml
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/import/load_data.xml	2007-03-19 18:22:21 UTC (rev 1639)
+++ trunk/rkward/rkward/plugins/00saveload/import/load_data.xml	2007-03-19 19:57:21 UTC (rev 1640)
@@ -1,12 +1,19 @@
 <!DOCTYPE rkplugin>
 <document> 
 	<code file="load_data.php"/>
+	<help file="load_data.rkh"/>
+	<logic>
+		<convert id="use_globalenv" mode="equals" sources="other_env.state" standard="0"/>
+		<connect client="globalenv_warning.visible" governor="use_globalenv"/>
 
-	<dialog label="Load an R object">
-		<tabbook>
-			<tab label="Select variables" >
-				<browser size="small" id="file" label="File name" filter="*.RData" />
-			</tab>
-		</tabbook>
+		<connect client="envir.enabled" governor="other_env.state"/>
+		<connect client="otherenv_warning.visible" governor="other_env.state"/>
+	</logic>
+	<dialog label="Load an R data file">
+		<browser size="small" id="file" label="R data file to load" filter="*.RData" />
+		<text id="globalenv_warning">WARNING: This may overwrite existing objects in .GlobalEnv. Be sure to save your workspace, first.</text>
+		<checkbox id="other_env" label="Save to specified environment" value="1" value_unchecked="0"/>
+		<saveobject id="envir" label="Environment to save to" initial="my.env"/>
+		<text id="otherenv_warning">WARNING: If the environment already exists, all objects inside it will be lost.</text>
 	</dialog>
 </document>

Modified: trunk/rkward/rkward/plugins/00saveload/import/source.php
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/import/source.php	2007-03-19 18:22:21 UTC (rev 1639)
+++ trunk/rkward/rkward/plugins/00saveload/import/source.php	2007-03-19 19:57:21 UTC (rev 1640)
@@ -3,8 +3,22 @@
 }
 
 function calculate () {
+	// most options should only be shown, if they differ from the default.
+	$options = "";
+	if (getRK_val ("echo")) {
+		$options .= ", echo=TRUE";
+		$prompt = getRK_val ("promptecho");
+		if (!empty ($prompt)) {
+			$options .= ", prompt.echo=\"" . $prompt . "\"";
+		}
+		$options .= ", max.deparse.length=" . getRK_val ("maxdeparselength");
+		$options .= ", verbose=" . getRK_val ("verbose");
+	} else {
+		$options .= ", verbose=FALSE";
+	}
+	$options .= ", print.eval=" . getRK_val ("printeval");
 ?>
-source (file="<? getRK("file"); ?>", local=<? getRK("local"); ?>, echo=<? getRK("echo"); ?>, print.eval= <? getRK("printeval"); ?>, verbose=<? getRK("verbose"); ?>, prompt.echo=<? getRK("promptecho"); ?>, max.deparse.length=<? getRK("maxdeparselength"); ?>, chdir=<? getRK("chdir"); ?>)
+source (file="<? getRK("file"); ?>", local=<? getRK("local"); echo ($options); ?>, chdir=<? getRK("chdir"); ?>)
 <?
 }
 

Added: trunk/rkward/rkward/plugins/00saveload/import/source.rkh
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/import/source.rkh	                        (rev 0)
+++ trunk/rkward/rkward/plugins/00saveload/import/source.rkh	2007-03-19 19:57:21 UTC (rev 1640)
@@ -0,0 +1,29 @@
+<!DOCTYPE rkhelp>
+<document>
+	<summary>
+Run an R source file.
+	</summary>
+
+	<usage>
+Select a file to load. This file will be loaded and interpreted as a script of R statements, which are then evaluated (see <link href="rkward://rhelp/source"/>).
+	</usage>
+
+	<settings>
+		<caption id="tab_main"/>
+		<setting id="file">The filename of the source file to run</setting>
+		<setting id="chdir">If checked, the working directory will be changed of the directory of the source file. This may be needed, if the source file refers to further files using relative paths.</setting>
+		<setting id="local">If checked, the source file is interpreted in a local environment, instead of the global environment. This is much safer, as no existing objects will be overwritten. On the other hand, if the purpose of the source file is to create new objects (in contrast to just producing printed output), it will have to be run in the global environment.</setting>
+		<caption id="tab_further"/>
+		<setting id="echo">Should each source statement be echoed after parsing, and before evaluation?</setting>
+		<setting id="promptecho">What should be printed at the start of each echoed source line (to differentiate it from the output)? Leave empty for the default.</setting>
+		<setting id="maxdeparselength">Maximum length of an echoed source line.</setting>
+		<setting id="verbose">Print additional diagnostics.</setting>
+		<setting id="printeval">Print the result of each single evaluation (instead of just the final result).</setting>
+	</settings>
+	<related>
+		<ul>
+			<li><link href="rkward://rhelp/source"/></li>
+			<li><link href="rkward://rhelp/local"/></li>
+		</ul>
+	</related>
+</document>

Modified: trunk/rkward/rkward/plugins/00saveload/import/source.xml
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/import/source.xml	2007-03-19 18:22:21 UTC (rev 1639)
+++ trunk/rkward/rkward/plugins/00saveload/import/source.xml	2007-03-19 19:57:21 UTC (rev 1640)
@@ -1,28 +1,33 @@
 <!DOCTYPE rkplugin>
 <document> 
 	<code file="source.php"/>
+	<help file="source.rkh"/>
 
 	<logic>
+		<convert id="global_env" mode="equals" sources="local.state" standard="FALSE"/>
+		<connect client="run_global_warning.visible" governor="global_env"/>
+
 		<connect client="maxdeparselength.enabled" governor="echo.state" />
+		<connect client="promptecho.enabled" governor="echo.state" />
+		<connect client="verbose.enabled" governor="echo.state" />
 	</logic>
-	<dialog label="Load source file" >
+	<dialog label="Load R source file" >
 		<tabbook>
-			<tab label="Select variables" >
-				<column>
-					<browser size="small" filter="*.R *.r" id="file" label="File name" />
-				</column>
-				<frame label="Options" >
-					
-					<checkbox value_unchecked="FALSE" checked="false" value="TRUE" id="local" label="Local environnement" />
-					<checkbox value_unchecked="FALSE" checked="false" value="TRUE" id="echo" label="Echo" />
-					<checkbox value_unchecked="FALSE" checked="false" value="TRUE" id="verbose" label="Verbose" />
-					<checkbox value_unchecked="FALSE" checked="false" value="TRUE" id="chdir" label="Change working directory" />
-					<checkbox value_unchecked="FALSE" checked="false" value="TRUE" id="printeval" label="Print eval" />
-					<input size="medium" initial = "getOption('prompt')" id="promptecho" label="Prompt"/>
-					<spinbox size="small" type="integer" id="maxdeparselength" min="1" initial="1" label="Maximal length of 'echo'" />
-					
-				</frame>
+			<tab label="Main options" id="tab_main">
+				<browser filter="*.R *.r" id="file" label="File name" />
+				<checkbox value_unchecked="FALSE" checked="false" value="TRUE" id="chdir" label="Use directory of source file as working directory" />
+				<checkbox value_unchecked="FALSE" checked="false" value="TRUE" id="local" label="Run in a local environment" />
+				<text id="run_global_warning">WARNING: This may overwrite existing objects without prompting!</text>
+				<stretch/>
 			</tab>
+			<tab label="Output options" id="tab_further">
+				<checkbox value_unchecked="0" checked="false" value="1" id="echo" label="Echo source statements" />
+				<input size="medium" initial="" id="promptecho" label="Prompt for echoed lines (empty for default)"/>
+				<spinbox size="small" type="integer" id="maxdeparselength" min="1" initial="150" label="Maximal length of echoed statements" />
+				<checkbox value_unchecked="FALSE" checked="false" value="TRUE" id="verbose" label="Verbose" />
+				<checkbox value_unchecked="FALSE" checked="false" value="TRUE" id="printeval" label="Print eval" />
+				<stretch/>
+			</tab>
 		</tabbook>
 	</dialog>
 </document>

Modified: trunk/rkward/rkward/plugins/Makefile.am
===================================================================
--- trunk/rkward/rkward/plugins/Makefile.am	2007-03-19 18:22:21 UTC (rev 1639)
+++ trunk/rkward/rkward/plugins/Makefile.am	2007-03-19 19:57:21 UTC (rev 1640)
@@ -214,13 +214,17 @@
 	distributions/clt/plot_hypergeometric_clt.xml \
 	distributions/clt/plot_hypergeometric_clt.rkh \
 	distributions/clt/plot_hypergeometric_clt.php \
-	distributions/clt/plot_geometric_clt.xml
+	distributions/clt/plot_geometric_clt.xml \
+	distributions/clt/plot_poisson_clt.php \
+	distributions/clt/plot_negbinomial_clt.xml \
+	distributions/clt/plot_wilcoxon_clt.rkh \
+	distributions/clt/plot_wilcoxon_clt.php \
+	distributions/clt/plot_poisson_clt.xml \
+	distributions/clt/plot_wilcoxon_clt.xml \
+	distributions/clt/plot_negbinomial_clt.rkh \
+	distributions/clt/plot_negbinomial_clt.php \
+	distributions/clt/plot_poisson_clt.rkh
 
-pluginsXwritetabledir = $(kde_datadir)/rkward/writetable
-dist_pluginsXwritetable_DATA = \
-	writetable/code.php \
-	writetable/description.xml
-
 pluginsXuni1D2dir = $(kde_datadir)/rkward/uni1.2
 dist_pluginsXuni1D2_DATA = \
 	uni1.2/code.php \
@@ -237,18 +241,11 @@
 	00saveload/setworkdir.php \
 	00saveload/setworkdir.xml
 
-pluginsX00saveloadXloaddir = $(kde_datadir)/rkward/00saveload/load
-pluginsX00saveloadXloadXloaddir = $(kde_datadir)/rkward/00saveload/load/load
-dist_pluginsX00saveloadXloadXload_DATA = \
-	00saveload/load/load/code.php \
-	00saveload/load/load/description.xml
+pluginsX00saveloadXsavedir = $(kde_datadir)/rkward/00saveload/save
+dist_pluginsX00saveloadXsave_DATA = \
+	00saveload/save/write_table.php \
+	00saveload/save/write_table.xml
 
-pluginsX00saveloadXloadXsourcedir = $(kde_datadir)/rkward/00saveload/load/source
-dist_pluginsX00saveloadXloadXsource_DATA = \
-	00saveload/load/source/code.php \
-	00saveload/load/source/description.xml
-
-pluginsX00saveloadXsavedir = $(kde_datadir)/rkward/00saveload/save
 pluginsX00saveloadXsaveXskeletondir = $(kde_datadir)/rkward/00saveload/save/skeleton
 dist_pluginsX00saveloadXsaveXskeleton_DATA = \
 	00saveload/save/skeleton/code.php \
@@ -271,7 +268,13 @@
 	00saveload/import/import_spss.rkh \
 	00saveload/import/import_csv.php \
 	00saveload/import/import_csv.xml \
-	00saveload/import/import_csv.rkh
+	00saveload/import/import_csv.rkh \
+	00saveload/import/load_data.php \
+	00saveload/import/load_data.xml \
+	00saveload/import/source.xml \
+	00saveload/import/source.php \
+	00saveload/import/load_data.rkh \
+	00saveload/import/source.rkh
 
 pluginsXanalysisdir = $(kde_datadir)/rkward/analysis
 dist_pluginsXanalysis_DATA = \

Modified: trunk/rkward/rkward/plugins/import_export.pluginmap
===================================================================
--- trunk/rkward/rkward/plugins/import_export.pluginmap	2007-03-19 18:22:21 UTC (rev 1639)
+++ trunk/rkward/rkward/plugins/import_export.pluginmap	2007-03-19 19:57:21 UTC (rev 1640)
@@ -2,10 +2,10 @@
 
 <document base_prefix="00saveload/" namespace="rkward">
 	<components>
-		<component type="standard" id="load_r_object" file="import/load_data.xml" label="Load an R Object" />
+		<component type="standard" id="load_r_object" file="import/load_data.xml" label="Load R data file" />
 		<component type="standard" id="load_source" file="import/source.xml" label="Load R source" />
 
-		<component type="standard" id="save_r_object" file="save/save/description.xml" label="Save an R Object" />
+		<component type="standard" id="save_r" file="save/save/description.xml" label="Save an R Object" />
 		<component type="standard" id="save_skeleton" file="save/skeleton/description.xml" label="Save package" />
 		<component type="standard" id="save_variables" file="save/write/description.xml" label="Save variables" />
 		<component type="standard" id="save_table" file="save/write_table.xml" label="Save as table" />
@@ -31,7 +31,7 @@
 				<entry component="load_source" />
 			</menu>
 			<menu id="export" label="Export" index="5">
-				<entry component="save_r_object" />
+				<entry component="save_r" />
 				<entry component="save_skeleton" />
 				<entry component="save_variables" />
 				<entry component="save_table" />


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