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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Thu Sep 15 10:34:03 UTC 2011


Revision: 3780
          http://rkward.svn.sourceforge.net/rkward/?rev=3780&view=rev
Author:   tfry
Date:     2011-09-15 10:34:02 +0000 (Thu, 15 Sep 2011)
Log Message:
-----------
Start updating tests.

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/rkward/plugins/plots/barplot.js
    trunk/rkward/rkward/plugins/plots/dotchart.js
    trunk/rkward/rkward/plugins/plots/piechart.js
    trunk/rkward/tests/analysis_plugins/crosstab_n_to_1.rkcommands.R
    trunk/rkward/tests/plots/barplot.rkcommands.R
    trunk/rkward/tests/plots/barplot.rkout
    trunk/rkward/tests/plots.R

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2011-09-15 08:11:26 UTC (rev 3779)
+++ trunk/rkward/ChangeLog	2011-09-15 10:34:02 UTC (rev 3780)
@@ -14,11 +14,11 @@
 - Fixed: Potential crash when using context menus with "focus follows mouse" window activation policy
 - Added shortcut Ctrl+Enter to insert a line break and submit from a script editor
 - Reduce CPU usage while idle
-- Barplot, dot chart, pie chart, and Pareto plot plugins gain more tabulation options				TODO: add and update tests
+- Bar plot, dot chart, pie chart, and Pareto plot plugins gain more tabulation options				TODO: add and update tests
 - rk.results() now prints rownames, where appropriate
 - "frame" elements in plugins can now be made checkable
 - Disabling or hiding a plugin component makes it non-required, implicitly
-- Boxplot gains option to dogde grouped boxes						TODO: add test; add colors?
+- Box plot gains option to dogde grouped boxes						TODO: add test; add colors?
 - Simplify internal handling of system() and system2() output					TODO: test on Windows!
 - Simplify code produced by several plugins
 - Fixed: Occasional duplication of first letter of keyword, when using "Copy lines to output" from the console window

Modified: trunk/rkward/rkward/plugins/plots/barplot.js
===================================================================
--- trunk/rkward/rkward/plugins/plots/barplot.js	2011-09-15 08:11:26 UTC (rev 3779)
+++ trunk/rkward/rkward/plugins/plots/barplot.js	2011-09-15 10:34:02 UTC (rev 3780)
@@ -11,7 +11,7 @@
 	var names_mode = getValue ("names_mode");
 
 	var tabulate = getValue ("tabulate.checked");
-	var main_header = '"Variable", rk.get.description (' + varname + ')';
+	var main_header = '"Variable"=rk.get.description (' + varname + ')';
 	if (tabulate) main_header = getValue ('tabulate_options.parameters');
 
 	var limit = getValue ("limit.checked");

Modified: trunk/rkward/rkward/plugins/plots/dotchart.js
===================================================================
--- trunk/rkward/rkward/plugins/plots/dotchart.js	2011-09-15 08:11:26 UTC (rev 3779)
+++ trunk/rkward/rkward/plugins/plots/dotchart.js	2011-09-15 10:34:02 UTC (rev 3780)
@@ -11,7 +11,7 @@
 	var names_mode = getValue ("names_mode");
 
 	var tabulate = getValue ("tabulate.checked");
-	var main_header = '"Variable", rk.get.description (' + vars + ')';
+	var main_header = '"Variable"=rk.get.description (' + vars + ')';
 	if (tabulate) main_header = getValue ('tabulate_options.parameters');
 
 	var limit = getValue ("limit.checked");

Modified: trunk/rkward/rkward/plugins/plots/piechart.js
===================================================================
--- trunk/rkward/rkward/plugins/plots/piechart.js	2011-09-15 08:11:26 UTC (rev 3779)
+++ trunk/rkward/rkward/plugins/plots/piechart.js	2011-09-15 10:34:02 UTC (rev 3780)
@@ -10,7 +10,7 @@
 	var vars = getValue ("x");
 
 	var tabulate = getValue ("tabulate.checked");
-	var main_header = '"Variable", rk.get.description (' + vars + ')';
+	var main_header = '"Variable"=rk.get.description (' + vars + ')';
 	if (tabulate) main_header = getValue ('tabulate_options.parameters');
 
 	var limit = getValue ("limit.checked");

Modified: trunk/rkward/tests/analysis_plugins/crosstab_n_to_1.rkcommands.R
===================================================================
--- trunk/rkward/tests/analysis_plugins/crosstab_n_to_1.rkcommands.R	2011-09-15 08:11:26 UTC (rev 3779)
+++ trunk/rkward/tests/analysis_plugins/crosstab_n_to_1.rkcommands.R	2011-09-15 10:34:02 UTC (rev 3780)
@@ -21,7 +21,7 @@
 	rk.header ("Pearson's Chi Square Test for Crosstabs", list ("Dependent", names (x)[1], "Independent", names (yvars)[i], "Method", chisquares[[i]][["method"]]), level=2)
 	rk.results (list ('Statistic'=chisquares[[i]][['statistic']], 'df'=chisquares[[i]][['parameter']], 'p'=chisquares[[i]][['p.value']]))
 
-	rk.header ("Barplot for Crosstabs", list ("Dependent", names (x)[1], "Independent", names (yvars)[i], "colors", "default", "Type", "juxtaposed", "Legend", "FALSE"), level=2)
+	rk.header ("Barplot for Crosstabs", list ("Dependent"=names (x)[1], "Independent"=names (yvars)[i], "colors"="default", "Type"="juxtaposed", "Legend"="FALSE"), level=2)
 	rk.graph.on ()
 	try ({
 		counts <- results[[i]]
@@ -65,7 +65,7 @@
 	rk.header ("Pearson's Chi Square Test for Crosstabs", list ("Dependent", names (x)[1], "Independent", names (yvars)[i], "Method", chisquares[[i]][["method"]]), level=2)
 	rk.results (list ('Statistic'=chisquares[[i]][['statistic']], 'df'=chisquares[[i]][['parameter']], 'p'=chisquares[[i]][['p.value']]))
 
-	rk.header ("Barplot for Crosstabs", list ("Dependent", names (x)[1], "Independent", names (yvars)[i], "colors", "rainbow", "Type", "juxtaposed", "Legend", "FALSE"), level=2)
+	rk.header ("Barplot for Crosstabs", list ("Dependent"=names (x)[1], "Independent"=names (yvars)[i], "colors"="rainbow", "Type"="juxtaposed", "Legend"="FALSE"), level=2)
 	rk.graph.on ()
 	try ({
 		counts <- results[[i]][, , "count"]

Modified: trunk/rkward/tests/plots/barplot.rkcommands.R
===================================================================
--- trunk/rkward/tests/plots/barplot.rkcommands.R	2011-09-15 08:11:26 UTC (rev 3779)
+++ trunk/rkward/tests/plots/barplot.rkcommands.R	2011-09-15 10:34:02 UTC (rev 3780)
@@ -7,7 +7,7 @@
 if(!is.matrix(x)) x <- as.vector(x)
 if(!is.matrix(x) && is.data.frame(x)) x <- data.matrix(x)
 names(x) <- rownames (swiss)
-rk.header ("Barplot", parameters=list ("Variable", rk.get.description (swiss[["Catholic"]]), "Tabulate", "No", "colors", "rainbow", "Type", "juxtaposed", "Legend", "FALSE"))
+rk.header ("Barplot", parameters=list ("Variable"=rk.get.description (swiss[["Catholic"]]), "colors"="rainbow", "Type"="juxtaposed", "Legend"="FALSE"))
 
 rk.graph.on ()
 try ({
@@ -28,7 +28,7 @@
 # barplot is a bit picky about attributes, so we need to convert to vector explicitely
 if(!is.matrix(x)) x <- as.vector(x)
 if(!is.matrix(x) && is.data.frame(x)) x <- data.matrix(x)
-rk.header ("Barplot", parameters=list ("Variable", rk.get.description (test_table), "Tabulate", "No", "colors", "default", "Type", "stacked", "Legend", "TRUE"))
+rk.header ("Barplot", parameters=list ("Variable"=rk.get.description (test_table), "colors"="default", "Type"="stacked", "Legend"="TRUE"))
 
 rk.graph.on ()
 try ({
@@ -36,3 +36,23 @@
 })
 rk.graph.off ()
 })
+local({
+## Prepare
+## Compute
+## Print result
+groups <- rk.list (warpbreaks[["wool"]], warpbreaks[["tension"]])
+title <- paste (names (groups), collapse=" by ")
+x <- by (warpbreaks[["breaks"]], interaction (groups), FUN=sum)
+rk.header ("Barplot", parameters=list ("Tabulation groups"=paste (names (groups), collapse=" by "), "Tabulation statistic"="Sum of warpbreaks[[\"breaks\"]]", "colors"="rainbow", "Type"="juxtaposed", "Legend"="TRUE"))
+
+rk.graph.on ()
+try ({
+	# adjust the range so that the labels will fit
+	yrange <- range (x, na.rm=TRUE) * 1.2
+	if (yrange[1] > 0) yrange[1] <- 0
+	if (yrange[2] < 0) yrange[2] <- 0
+	bplot <- barplot(x, col=rainbow (if(is.matrix(x)) dim(x) else length(x)), beside=TRUE, legend.text=TRUE, ylim = yrange, xlab=title, ylab="Sum of warpbreaks[[\"breaks\"]]")
+	text (bplot,x, labels=x, pos=3, offset=.5)
+})
+rk.graph.off ()
+})

Modified: trunk/rkward/tests/plots/barplot.rkout
===================================================================
--- trunk/rkward/tests/plots/barplot.rkout	2011-09-15 08:11:26 UTC (rev 3779)
+++ trunk/rkward/tests/plots/barplot.rkout	2011-09-15 10:34:02 UTC (rev 3780)
@@ -1,7 +1,6 @@
 <h1>Barplot</h1>
 <h2>Parameters</h2>
 <ul><li>Variable: Catholic</li>
-<li>Tabulate: No</li>
 <li>colors: rainbow</li>
 <li>Type: juxtaposed</li>
 <li>Legend: FALSE</li>
@@ -11,10 +10,19 @@
 <h1>Barplot</h1>
 <h2>Parameters</h2>
 <ul><li>Variable: test_table</li>
-<li>Tabulate: No</li>
 <li>colors: default</li>
 <li>Type: stacked</li>
 <li>Legend: TRUE</li>
 </ul>
 DATE<br />
 <img src="graph.png" width="480" height="480"><br>
+<h1>Barplot</h1>
+<h2>Parameters</h2>
+<ul><li>Tabulation groups: wool by tension</li>
+<li>Tabulation statistic: Sum of warpbreaks[["breaks"]]</li>
+<li>colors: rainbow</li>
+<li>Type: juxtaposed</li>
+<li>Legend: TRUE</li>
+</ul>
+DATE<br />
+<img src="graph.png" width="480" height="480"><br>

Modified: trunk/rkward/tests/plots.R
===================================================================
--- trunk/rkward/tests/plots.R	2011-09-15 08:11:26 UTC (rev 3779)
+++ trunk/rkward/tests/plots.R	2011-09-15 10:34:02 UTC (rev 3780)
@@ -18,9 +18,11 @@
 	## the tests
 	), tests = list (
 		new ("RKTest", id="barplot", call=function () {
-			rk.call.plugin ("rkward::barplot", barplot_embed.colors.string="rainbow", barplot_embed.labels.state="1", barplot_embed.legend.state="0", barplot_embed.place.string="3", barplot_embed.plotoptions.add_grid.state="0", barplot_embed.plotoptions.asp.real="0.00", barplot_embed.plotoptions.main.text="", barplot_embed.plotoptions.pointcolor.color.string="", barplot_embed.plotoptions.pointtype.string="", barplot_embed.plotoptions.sub.text="", barplot_embed.plotoptions.xaxt.state="", barplot_embed.plotoptions.xlab.text="", barplot_embed.plotoptions.xlog.state="", barplot_embed.plotoptions.xmaxvalue.text="", barplot_embed.plotoptions.xminvalue.text="", barplot_embed.plotoptions.yaxt.state="", barplot_embed.plotoptions.ylab.text="", barplot_embed.plotoptions.ylog.state="", barplot_embed.plotoptions.ymaxvalue.text="", barplot_embed.plotoptions.yminvalue.text="", barplot_embed.type.string="juxtaposed", names_exp.text="rownames (swiss)", names_mode.string="rexp", tabulate.state="0", x.available="swiss[[\"Catholic\"]]", submit.mode="submit")
+			rk.call.plugin ("rkward::barplot", barplot_embed.colors.string="rainbow", barplot_embed.labels.state="1", barplot_embed.legend.state="0", barplot_embed.place.string="3", barplot_embed.plotoptions.add_grid.state="0", barplot_embed.plotoptions.asp.real="0.00", barplot_embed.plotoptions.main.text="", barplot_embed.plotoptions.pointcolor.color.string="", barplot_embed.plotoptions.pointtype.string="", barplot_embed.plotoptions.sub.text="", barplot_embed.plotoptions.xaxt.state="", barplot_embed.plotoptions.xlab.text="", barplot_embed.plotoptions.xlog.state="", barplot_embed.plotoptions.xmaxvalue.text="", barplot_embed.plotoptions.xminvalue.text="", barplot_embed.plotoptions.yaxt.state="", barplot_embed.plotoptions.ylab.text="", barplot_embed.plotoptions.ylog.state="", barplot_embed.plotoptions.ymaxvalue.text="", barplot_embed.plotoptions.yminvalue.text="", barplot_embed.type.string="juxtaposed", names_exp.text="rownames (swiss)", names_mode.string="rexp", tabulate.checked="0", x.available="swiss[[\"Catholic\"]]", submit.mode="submit")
 
-			rk.call.plugin ("rkward::barplot", barplot_embed.colors.string="default", barplot_embed.legend.state="1", barplot_embed.plotoptions.add_grid.state="0", barplot_embed.plotoptions.asp.real="0.00", barplot_embed.plotoptions.main.text="", barplot_embed.plotoptions.pointcolor.color.string="", barplot_embed.plotoptions.pointtype.string="", barplot_embed.plotoptions.sub.text="", barplot_embed.plotoptions.xaxt.state="", barplot_embed.plotoptions.xlab.text="", barplot_embed.plotoptions.xlog.state="", barplot_embed.plotoptions.xmaxvalue.text="", barplot_embed.plotoptions.xminvalue.text="", barplot_embed.plotoptions.yaxt.state="", barplot_embed.plotoptions.ylab.text="", barplot_embed.plotoptions.ylog.state="", barplot_embed.plotoptions.ymaxvalue.text="", barplot_embed.plotoptions.yminvalue.text="", barplot_embed.type.string="stacked", names_exp.text="names (x)", names_mode.string="default", tabulate.state="0", x.available="test_table", submit.mode="submit")
+			rk.call.plugin ("rkward::barplot", barplot_embed.colors.string="default", barplot_embed.legend.state="1", barplot_embed.plotoptions.add_grid.state="0", barplot_embed.plotoptions.asp.real="0.00", barplot_embed.plotoptions.main.text="", barplot_embed.plotoptions.pointcolor.color.string="", barplot_embed.plotoptions.pointtype.string="", barplot_embed.plotoptions.sub.text="", barplot_embed.plotoptions.xaxt.state="", barplot_embed.plotoptions.xlab.text="", barplot_embed.plotoptions.xlog.state="", barplot_embed.plotoptions.xmaxvalue.text="", barplot_embed.plotoptions.xminvalue.text="", barplot_embed.plotoptions.yaxt.state="", barplot_embed.plotoptions.ylab.text="", barplot_embed.plotoptions.ylog.state="", barplot_embed.plotoptions.ymaxvalue.text="", barplot_embed.plotoptions.yminvalue.text="", barplot_embed.type.string="stacked", names_exp.text="names (x)", names_mode.string="default", tabulate.checked="0", x.available="test_table", submit.mode="submit")
+
+			rk.call.plugin ("rkward::barplot", barplot_embed.colors.string="rainbow", barplot_embed.labels.state="1", barplot_embed.legend.state="1", barplot_embed.place.string="3", barplot_embed.plotoptions.add_grid.state="0", barplot_embed.plotoptions.asp.real="0.00", barplot_embed.plotoptions.main.text="", barplot_embed.plotoptions.pointcolor.color.string="", barplot_embed.plotoptions.pointtype.string="", barplot_embed.plotoptions.sub.text="", barplot_embed.plotoptions.xaxt.state="", barplot_embed.plotoptions.xlab.text="", barplot_embed.plotoptions.xlog.state="", barplot_embed.plotoptions.yaxt.state="", barplot_embed.plotoptions.ylab.text="", barplot_embed.plotoptions.ylog.state="", barplot_embed.type.string="juxtaposed", limit.checked="0", names_mode.string="default", tabulate.checked="1", tabulate_options.groups.available="warpbreaks[[\"wool\"]]\nwarpbreaks[[\"tension\"]]", tabulate_options.outcome.available="warpbreaks[[\"breaks\"]]", tabulate_options.stat.string="sum", submit.mode="submit")
 		}),
 		new ("RKTest", id="boxplot", call=function () {
 			rk.call.plugin ("rkward::box_plot", cex_sd_mean.real="1.00", mean.state="TRUE", names_exp.text="names (x)", names_mode.string="default", notch.state="FALSE", orientation.string="FALSE", outline.state="TRUE", pch_mean.real="15.", plotoptions.add_grid.state="0", plotoptions.asp.real="0.00", plotoptions.main.text="", plotoptions.pointcolor.color.string="", plotoptions.pointtype.string="", plotoptions.sub.text="", plotoptions.xaxt.state="", plotoptions.xlab.text="", plotoptions.xlog.state="", plotoptions.xmaxvalue.text="", plotoptions.xminvalue.text="", plotoptions.yaxt.state="", plotoptions.ylab.text="", plotoptions.ylog.state="", plotoptions.ymaxvalue.text="", plotoptions.yminvalue.text="", sd.state="", sd_mean_color.color.string="blue", x.available="women[[\"weight\"]]\nwomen[[\"height\"]]", submit.mode="submit")

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