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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Sun Feb 20 12:15:09 UTC 2011


Revision: 3446
          http://rkward.svn.sourceforge.net/rkward/?rev=3446&view=rev
Author:   tfry
Date:     2011-02-20 12:15:08 +0000 (Sun, 20 Feb 2011)

Log Message:
-----------
Minor correction (and simplification) to CSV import plugin

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/00saveload/import/import_csv.js
    trunk/rkward/rkward/plugins/00saveload/import/import_csv.xml
    trunk/rkward/tests/import_export_plugins/RKTestStandard.import_csv.rkcommands.R
    trunk/rkward/tests/import_export_plugins.R

Modified: trunk/rkward/rkward/plugins/00saveload/import/import_csv.js
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/import/import_csv.js	2011-02-17 18:43:35 UTC (rev 3445)
+++ trunk/rkward/rkward/plugins/00saveload/import/import_csv.js	2011-02-20 12:15:08 UTC (rev 3446)
@@ -17,11 +17,11 @@
 	}
 // Other method is to use read.table and show all the options - more transparent
 	echo ('imported <- read.' + quick + ' (file="' + getValue("file") + '"' + tableOptions + ', '); // doing row names (what a pity...)
-	if (getValue("rowname")!="NULL") {
-		echo ("row.names = ");
-		if (getValue("rowname")=="rowcol") echo (getValue("nomrow") + ",");
-		else echo (getValue("rownames") + ",");
-	}
+	var rowNameMode = getValue ("rowname");
+	if (rowNameMode == "number") echo ("row.names=NULL, ");
+	else if (rowNameMode == "rowcol") echo ("row.names=" + getValue("nomrow") + ", ");
+	else if (rowNameMode == "custoRow") echo ("row.names=" + getValue("rownames") + ", ");
+
 	// doing col names (what a pity...)
 	if (getValue("colname") == "custoCol") echo ( "col.names = " + getValue ("colnames") + ",");
 	// doing col class (what a pity...)

Modified: trunk/rkward/rkward/plugins/00saveload/import/import_csv.xml
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/import/import_csv.xml	2011-02-17 18:43:35 UTC (rev 3445)
+++ trunk/rkward/rkward/plugins/00saveload/import/import_csv.xml	2011-02-20 12:15:08 UTC (rev 3446)
@@ -52,8 +52,6 @@
 		<connect client="custom_quote.enabled" governor="customquote" />
 		<connect client="custom_quote.required" governor="custom_quote.enabled" />
 
-		<connect client="rowname.enabled" governor="isrow.state" />
-		
 		<convert id="userow" mode="equals" sources="rowname.string" standard="rowcol" />
 		<convert id="customizerow" mode="equals" sources="rowname.string" standard="custoRow" />
 		<convert id="customizerow2" mode="and" sources="isrow.state;customizerow" standard="custoRow" />
@@ -112,14 +110,15 @@
 				<row>
 					<column>
 						<frame label="Row Specifications">
-							<checkbox value_unchecked="false" checked="false" value="true" id="isrow" label="Customize row names" />
-							<radio id="rowname" label="Rows names" >
-								<option value="NULL" label="Number" />
+							<radio id="rowname" label="Row names" >
+								<option value="auto" checked="true" label="Automatic" />
+								<option value="number" label="Numeric row names" />
 								<option value="rowcol" label="As specified in column x:" />
 								<option value="custoRow" label="Use a vector" />
 							</radio>
 							<input size="small" id="nomrow" initial="1" label="Column number or variable name" />
 							<input id="rownames" label="Vector of row names (quoted)" />
+							<stretch/>
 						</frame>
 					</column>
 					<column>

Modified: trunk/rkward/tests/import_export_plugins/RKTestStandard.import_csv.rkcommands.R
===================================================================
--- trunk/rkward/tests/import_export_plugins/RKTestStandard.import_csv.rkcommands.R	2011-02-17 18:43:35 UTC (rev 3445)
+++ trunk/rkward/tests/import_export_plugins/RKTestStandard.import_csv.rkcommands.R	2011-02-20 12:15:08 UTC (rev 3446)
@@ -1,7 +1,7 @@
 local({
 ## Prepare
 ## Compute
-imported <- read.csv (file="women.csv", row.names = 1, na.strings = "NA", nrows = -1, skip = 0, check.names = TRUE, strip.white = FALSE, blank.lines.skip = TRUE)
+imported <- read.csv (file="women.csv", row.names=1,  na.strings = "NA", nrows = -1, skip = 0, check.names = TRUE, strip.white = FALSE, blank.lines.skip = TRUE)
 
 # copy from the local environment to globalenv()
 .GlobalEnv$women <- imported
@@ -9,5 +9,5 @@
 rk.header("Import text / csv data", parameters=list("File", "women.csv",
 	"Import as", "women"))
 })
-.rk.rerun.plugin.link(plugin="rkward::import_csv", settings="allow_escapes.state=\nblanklinesskip.state=TRUE\ncheckname.state=TRUE\ncolclass.string=\ncolname.string=\ndec.string='.'\ndoedit.state=0\nfile.selection=women.csv\nflush.state=\nisrow.state=true\nna.text=NA\nname.objectname=women\nname.parent=.GlobalEnv\nnomrow.text=1\nnrows.text=-1\nquick.string=csv\nquote.string='\\\\\\\"'\nrowname.string=rowcol\nsep.string=','\nskip.text=0\nstrings_as_factors.string=\nstripwhite.state=FALSE", label="Run again")
+.rk.rerun.plugin.link(plugin="rkward::import_csv", settings="allow_escapes.state=\nblanklinesskip.state=TRUE\ncheckname.state=TRUE\ncolclass.string=\ncolname.string=\ndec.string='.'\ndoedit.state=0\nfile.selection=women.csv\nflush.state=\nna.text=NA\nname.objectname=women\nname.parent=.GlobalEnv\nnomrow.text=1\nnrows.text=-1\nquick.string=csv\nquote.string='\\\\\\\"'\nrowname.string=rowcol\nsep.string=','\nskip.text=0\nstrings_as_factors.string=\nstripwhite.state=FALSE", label="Run again")
 .rk.make.hr()

Modified: trunk/rkward/tests/import_export_plugins.R
===================================================================
--- trunk/rkward/tests/import_export_plugins.R	2011-02-17 18:43:35 UTC (rev 3445)
+++ trunk/rkward/tests/import_export_plugins.R	2011-02-20 12:15:08 UTC (rev 3446)
@@ -21,7 +21,7 @@
 		new ("RKTest", id="import_csv", call=function () {
 			write.csv (women.data, file="women.csv")
 
-			rk.call.plugin ("rkward::import_csv", allow_escapes.state="", blanklinesskip.state="TRUE", checkname.state="TRUE", colclass.string="", colname.string="", dec.string="'.'", doedit.state="0", file.selection="women.csv", flush.state="", isrow.state="true", na.text="NA", name.objectname="women", nrows.text="-1", quick.string="csv", quote.string="'\\\"'", sep.string="','", skip.text="0", strings_as_factors.string="", stripwhite.state="FALSE", rowname.string="rowcol", nomrow.text="1", submit.mode="submit")
+			rk.call.plugin ("rkward::import_csv", allow_escapes.state="", blanklinesskip.state="TRUE", checkname.state="TRUE", colclass.string="", colname.string="", dec.string="'.'", doedit.state="0", file.selection="women.csv", flush.state="", na.text="NA", name.objectname="women", nrows.text="-1", quick.string="csv", quote.string="'\\\"'", sep.string="','", skip.text="0", strings_as_factors.string="", stripwhite.state="FALSE", rowname.string="rowcol", nomrow.text="1", submit.mode="submit")
 
 			stopifnot (all.equal (.GlobalEnv$women, datasets::women))
 		}),


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