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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Wed Aug 19 13:12:19 UTC 2009


Revision: 2613
          http://rkward.svn.sourceforge.net/rkward/?rev=2613&view=rev
Author:   tfry
Date:     2009-08-19 13:12:19 +0000 (Wed, 19 Aug 2009)

Log Message:
-----------
Slightly beef up the 'write' plugin (probably it's still not too useful...).
(This is a side-effect of writing further tests)

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/import_export.pluginmap

Added Paths:
-----------
    trunk/rkward/rkward/plugins/00saveload/save/write.php
    trunk/rkward/rkward/plugins/00saveload/save/write.xml

Removed Paths:
-------------
    trunk/rkward/rkward/plugins/00saveload/save/write/

Copied: trunk/rkward/rkward/plugins/00saveload/save/write.php (from rev 2611, trunk/rkward/rkward/plugins/00saveload/save/write/code.php)
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/save/write.php	                        (rev 0)
+++ trunk/rkward/rkward/plugins/00saveload/save/write.php	2009-08-19 13:12:19 UTC (rev 2613)
@@ -0,0 +1,18 @@
+<?
+function preprocess () {
+}
+
+function calculate () {
+	$sep = getRK_val ("sep");
+	if ($sep == "other") $sep = getRK_val ("custom_sep");
+	if ($sep == " ") $sep = "";
+	else $sep = ", sep=" . quote ($sep);
+?>
+write (x=<? getRK("data"); ?>, file="<? getRK("file"); ?>", ncolumns=<? getRK("ncolumns"); ?>, append=<? getRK("append"); echo ($sep); ?>)
+<?
+}
+
+function printout () {
+	makeHeaderCode ("Write Variables", array ("File" => getRK_val ("file"), "Data" => getRK_val ("data")));
+}
+?>

Copied: trunk/rkward/rkward/plugins/00saveload/save/write.xml (from rev 2611, trunk/rkward/rkward/plugins/00saveload/save/write/description.xml)
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/save/write.xml	                        (rev 0)
+++ trunk/rkward/rkward/plugins/00saveload/save/write.xml	2009-08-19 13:12:19 UTC (rev 2613)
@@ -0,0 +1,43 @@
+<!DOCTYPE rkplugin>
+<document>
+	<code file="write.php"/>
+	<logic>
+		<convert id="several_columns" mode="range" min="2" sources="ncolumns.int"/>
+		<connect client="sep.enabled" governor="several_columns" />
+
+		<convert id="customsep" mode="equals" sources="sep.string" standard="other" />
+		<convert id="enable_customsep" mode="and" sources="customsep;sep.enables" />
+		<connect client="custom_sep.enabled" governor="enable_customsep" />
+		<connect client="custom_sep.required" governor="custom_sep.enabled" />
+	</logic>
+
+	<dialog label="Write vector / matrix" >
+		<tabbook>
+			<tab label="Select variables" >
+			<column>
+				<varselector id="vars" label="Select a vector or matrix" />
+				<varslot multi="false" classes="character numeric integer factor matrix" id="data" source="vars" label="Data" required="true" />
+				<browser size="small" initial="data" id="file" label="File name" />
+			</column>
+			<frame label="Options" >
+				<row>
+					<column>
+						<radio id="sep" label="Field separator character" >
+							<option id="sepTab" value="\t" label="Tab" />
+							<option id="sepSemiC" value=";" label="';' (Semicolon)" />
+							<option id="sepComma" value="," label="',' (Comma)" />
+							<option id="sepSpace" value=" " label="Space" checked="true" />
+							<option id="sepOther" value="other" label="Other (specify below)" />
+						</radio>
+						<input id="custom_sep" label="Specify field separator character" />
+					</column>
+					<column>
+						<spinbox type="integer" initial="1" min="1" id="ncolumns" max="100" label="Number of columns to write" />
+						<checkbox value_unchecked="FALSE" checked="false" value="TRUE" id="append" label="Append to existing file" />
+					</column>
+				</row>
+			</frame>
+			</tab>
+		</tabbook>
+	</dialog>
+</document>

Modified: trunk/rkward/rkward/plugins/import_export.pluginmap
===================================================================
--- trunk/rkward/rkward/plugins/import_export.pluginmap	2009-08-18 10:13:13 UTC (rev 2612)
+++ trunk/rkward/rkward/plugins/import_export.pluginmap	2009-08-19 13:12:19 UTC (rev 2613)
@@ -7,8 +7,8 @@
 
 		<component type="standard" id="save_r" file="save/save/description.xml" label="Save R Objects" />
 		<component type="standard" id="save_skeleton" file="save/skeleton/description.xml" label="Create package skeleton" />
-		<component type="standard" id="save_variables" file="save/write/description.xml" label="Write variables" />
-		<component type="standard" id="save_table" file="save/write_table.xml" label="Write as table" />
+		<component type="standard" id="save_variables" file="save/write.xml" label="Write vector / matrix" />
+		<component type="standard" id="save_table" file="save/write_table.xml" label="Write table" />
 
 		<component type="standard" id="import_spss" file="import/import_spss.xml" label="Import SPSS">
 			<attribute id="format" value="*.sav *.por" label="SPSS data files"/>


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