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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Thu Sep 15 15:12:33 UTC 2011


Revision: 3783
          http://rkward.svn.sourceforge.net/rkward/?rev=3783&view=rev
Author:   tfry
Date:     2011-09-15 15:12:32 +0000 (Thu, 15 Sep 2011)
Log Message:
-----------
More test updates

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/rkward/plugins/plots/piechart.js
    trunk/rkward/tests/plots/pareto_chart.rkcommands.R
    trunk/rkward/tests/plots/pareto_chart.rkout
    trunk/rkward/tests/plots/piechart.rkcommands.R
    trunk/rkward/tests/plots/piechart.rkout
    trunk/rkward/tests/plots.R

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2011-09-15 14:01:46 UTC (rev 3782)
+++ trunk/rkward/ChangeLog	2011-09-15 15:12:32 UTC (rev 3783)
@@ -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
-- Bar plot, 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
 - 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
-- Box plot gains option to dogde grouped boxes						TODO: add test; add colors?
+- Box plot gains option to dogde grouped boxes
 - 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/piechart.js
===================================================================
--- trunk/rkward/rkward/plugins/plots/piechart.js	2011-09-15 14:01:46 UTC (rev 3782)
+++ trunk/rkward/rkward/plugins/plots/piechart.js	2011-09-15 15:12:32 UTC (rev 3783)
@@ -51,7 +51,6 @@
 		echo (getValue ('tabulate_options.code.calculate'));
 	} else {
 		echo ('x <- ' + getValue ("x") + '\n');
-		echo ('title <- rk.get.description (' + getValue ("x") + ')\n');
 		echo ('if (!is.numeric (x)) {\n');
 		echo ('	warning ("Data is not numeric, but proceeding as requested.\\nDid you forget to check the tabulate option?")\n');
 		echo ('}\n');

Modified: trunk/rkward/tests/plots/pareto_chart.rkcommands.R
===================================================================
--- trunk/rkward/tests/plots/pareto_chart.rkcommands.R	2011-09-15 14:01:46 UTC (rev 3782)
+++ trunk/rkward/tests/plots/pareto_chart.rkcommands.R	2011-09-15 15:12:32 UTC (rev 3783)
@@ -1,20 +1,41 @@
 local({
 ## Prepare
 require(qcc)
-require(xtable)
 ## Compute
-## Print result
-x <- swiss[["Catholic"]]
+x <- swiss[["Education"]]
+title <- rk.get.description (swiss[["Education"]])
 if (!is.numeric (x)) {
-	warning ("Data may not be numeric, but proceeding as requested.\nDid you forget to check the tabulate option?")
+	warning ("Data is not numeric, but proceeding as requested.\nDid you forget to check the tabulate option?")
 }
+max.categories <- 10
+if (length (x) > max.categories) {
+	x <- sort (x, decreasing=TRUE)
+	x <- x[1:max.categories]
+}
+## Print result
+rk.header ("Pareto chart", parameters=list ("Variable"=title, "Limit"="10 largest values"))
 
-rk.header ("Pareto chart")
+rk.graph.on ()
+try ({
+	descriptives <- pareto.chart(x, ylab="Frequency", main=title)
+	rk.results(data.frame(descriptives))
+})
+rk.graph.off ()
+})
+local({
+## Prepare
+require(qcc)
+## Compute
+groups <- rk.list (warpbreaks[["wool"]], warpbreaks[["tension"]])
+title <- paste (names (groups), collapse=" by ")
+x <- by (warpbreaks[["breaks"]], interaction (groups), FUN=sum)
+## Print result
+rk.header ("Pareto chart", parameters=list ("Tabulation groups"=paste (names (groups), collapse=" by "), "Tabulation statistic"="Sum of warpbreaks[[\"breaks\"]]"))
 
 rk.graph.on ()
 try ({
-	descriptives <- pareto.chart(x, main="swiss[[\"Catholic\"]]")
-	rk.results(xtable(descriptives))
+	descriptives <- pareto.chart(x, ylab="Sum of warpbreaks[[\"breaks\"]]", main=title)
+	rk.results(data.frame(descriptives))
 })
 rk.graph.off ()
 })

Modified: trunk/rkward/tests/plots/pareto_chart.rkout
===================================================================
--- trunk/rkward/tests/plots/pareto_chart.rkout	2011-09-15 14:01:46 UTC (rev 3782)
+++ trunk/rkward/tests/plots/pareto_chart.rkout	2011-09-15 15:12:32 UTC (rev 3783)
@@ -1,53 +1,36 @@
 <h1>Pareto chart</h1>
+<h2>Parameters</h2>
+<ul><li>Variable: Education</li>
+<li>Limit: 10 largest values</li>
+</ul>
 DATE<br />
 <img src="graph.png" width="480" height="480"><br><table border="1">
-<tr><td>Frequency</td><td>Cum.Freq.</td><td>Percentage</td><td>Cum.Percent.</td></tr>
-<tr><td>100</td><td>100</td><td>5.1713</td><td>5.1713</td></tr>
-<tr><td>99.71</td><td>199.71</td><td>5.1563</td><td>10.328</td></tr>
-<tr><td>99.68</td><td>299.39</td><td>5.1547</td><td>15.482</td></tr>
-<tr><td>99.46</td><td>398.85</td><td>5.1433</td><td>20.626</td></tr>
-<tr><td>99.06</td><td>497.91</td><td>5.1227</td><td>25.748</td></tr>
-<tr><td>98.96</td><td>596.87</td><td>5.1175</td><td>30.866</td></tr>
-<tr><td>98.61</td><td>695.48</td><td>5.0994</td><td>35.965</td></tr>
-<tr><td>98.22</td><td>793.7</td><td>5.0792</td><td>41.044</td></tr>
-<tr><td>97.67</td><td>891.37</td><td>5.0508</td><td>46.095</td></tr>
-<tr><td>97.16</td><td>988.53</td><td>5.0244</td><td>51.12</td></tr>
-<tr><td>96.83</td><td>1085.4</td><td>5.0073</td><td>56.127</td></tr>
-<tr><td>93.4</td><td>1178.8</td><td>4.83</td><td>60.957</td></tr>
-<tr><td>92.85</td><td>1271.6</td><td>4.8015</td><td>65.758</td></tr>
-<tr><td>91.38</td><td>1363</td><td>4.7255</td><td>70.484</td></tr>
-<tr><td>90.57</td><td>1453.6</td><td>4.6836</td><td>75.168</td></tr>
-<tr><td>84.84</td><td>1538.4</td><td>4.3873</td><td>79.555</td></tr>
-<tr><td>58.33</td><td>1596.7</td><td>3.0164</td><td>82.571</td></tr>
-<tr><td>50.43</td><td>1647.2</td><td>2.6079</td><td>85.179</td></tr>
-<tr><td>42.34</td><td>1689.5</td><td>2.1895</td><td>87.369</td></tr>
-<tr><td>33.77</td><td>1723.3</td><td>1.7463</td><td>89.115</td></tr>
-<tr><td>24.2</td><td>1747.5</td><td>1.2514</td><td>90.366</td></tr>
-<tr><td>18.46</td><td>1765.9</td><td>0.95462</td><td>91.321</td></tr>
-<tr><td>16.92</td><td>1782.8</td><td>0.87498</td><td>92.196</td></tr>
-<tr><td>15.14</td><td>1798</td><td>0.78293</td><td>92.979</td></tr>
-<tr><td>13.79</td><td>1811.8</td><td>0.71312</td><td>93.692</td></tr>
-<tr><td>12.11</td><td>1823.9</td><td>0.62624</td><td>94.318</td></tr>
-<tr><td>11.22</td><td>1835.1</td><td>0.58022</td><td>94.899</td></tr>
-<tr><td>9.96</td><td>1845.1</td><td>0.51506</td><td>95.414</td></tr>
-<tr><td>8.65</td><td>1853.7</td><td>0.44732</td><td>95.86</td></tr>
-<tr><td>8.52</td><td>1862.2</td><td>0.44059</td><td>96.302</td></tr>
-<tr><td>7.72</td><td>1870.0</td><td>0.39922</td><td>96.7</td></tr>
-<tr><td>6.1</td><td>1876.1</td><td>0.31545</td><td>97.016</td></tr>
-<tr><td>5.62</td><td>1881.7</td><td>0.29063</td><td>97.307</td></tr>
-<tr><td>5.23</td><td>1886.9</td><td>0.27046</td><td>97.577</td></tr>
-<tr><td>5.23</td><td>1892.1</td><td>0.27046</td><td>97.848</td></tr>
-<tr><td>5.16</td><td>1897.3</td><td>0.26684</td><td>98.115</td></tr>
-<tr><td>4.97</td><td>1902.3</td><td>0.25701</td><td>98.372</td></tr>
-<tr><td>4.52</td><td>1906.8</td><td>0.23374</td><td>98.605</td></tr>
-<tr><td>4.43</td><td>1911.2</td><td>0.22909</td><td>98.834</td></tr>
-<tr><td>4.2</td><td>1915.4</td><td>0.21719</td><td>99.052</td></tr>
-<tr><td>3.3</td><td>1918.7</td><td>0.17065</td><td>99.222</td></tr>
-<tr><td>2.84</td><td>1921.6</td><td>0.14686</td><td>99.37</td></tr>
-<tr><td>2.82</td><td>1924.4</td><td>0.14583</td><td>99.515</td></tr>
-<tr><td>2.56</td><td>1926.9</td><td>0.13238</td><td>99.647</td></tr>
-<tr><td>2.4</td><td>1929.3</td><td>0.12411</td><td>99.771</td></tr>
-<tr><td>2.27</td><td>1931.6</td><td>0.11739</td><td>99.889</td></tr>
-<tr><td>2.15</td><td>1933.8</td><td>0.11118</td><td>100</td></tr>
+<tr><td></td><td>Frequency</td><td>Cum.Freq.</td><td>Percentage</td><td>Cum.Percent.</td></tr>
+<tr><td>A</td><td>53</td><td>53</td><td>21.116</td><td>21.116</td></tr>
+<tr><td>B</td><td>32</td><td>85</td><td>12.749</td><td>33.865</td></tr>
+<tr><td>D</td><td>29</td><td>114</td><td>11.554</td><td>45.418</td></tr>
+<tr><td>C</td><td>29</td><td>143</td><td>11.554</td><td>56.972</td></tr>
+<tr><td>E</td><td>28</td><td>171</td><td>11.155</td><td>68.127</td></tr>
+<tr><td>F</td><td>20</td><td>191</td><td>7.9681</td><td>76.096</td></tr>
+<tr><td>G</td><td>19</td><td>210</td><td>7.5697</td><td>83.665</td></tr>
+<tr><td>H</td><td>15</td><td>225</td><td>5.9761</td><td>89.641</td></tr>
+<tr><td>J</td><td>13</td><td>238</td><td>5.1793</td><td>94.821</td></tr>
+<tr><td>I</td><td>13</td><td>251</td><td>5.1793</td><td>100</td></tr>
 </table>
 
+<h1>Pareto chart</h1>
+<h2>Parameters</h2>
+<ul><li>Tabulation groups: wool by tension</li>
+<li>Tabulation statistic: Sum of warpbreaks[["breaks"]]</li>
+</ul>
+DATE<br />
+<img src="graph.png" width="480" height="480"><br><table border="1">
+<tr><td></td><td>Frequency</td><td>Cum.Freq.</td><td>Percentage</td><td>Cum.Percent.</td></tr>
+<tr><td>A.L</td><td>401</td><td>401</td><td>26.382</td><td>26.382</td></tr>
+<tr><td>B.M</td><td>259</td><td>660</td><td>17.039</td><td>43.421</td></tr>
+<tr><td>B.L</td><td>254</td><td>914</td><td>16.711</td><td>60.132</td></tr>
+<tr><td>A.H</td><td>221</td><td>1135</td><td>14.539</td><td>74.671</td></tr>
+<tr><td>A.M</td><td>216</td><td>1351</td><td>14.211</td><td>88.882</td></tr>
+<tr><td>B.H</td><td>169</td><td>1520</td><td>11.118</td><td>100</td></tr>
+</table>
+

Modified: trunk/rkward/tests/plots/piechart.rkcommands.R
===================================================================
--- trunk/rkward/tests/plots/piechart.rkcommands.R	2011-09-15 14:01:46 UTC (rev 3782)
+++ trunk/rkward/tests/plots/piechart.rkcommands.R	2011-09-15 15:12:32 UTC (rev 3783)
@@ -4,10 +4,10 @@
 ## Print result
 x <- test_table[["A"]]
 if (!is.numeric (x)) {
-	warning ("Data may not be numeric, but proceeding as requested.\nDid you forget to check the tabulate option?")
+	warning ("Data is not numeric, but proceeding as requested.\nDid you forget to check the tabulate option?")
 }
 
-rk.header ("Pie chart", parameters=list ("Variable", rk.get.description (test_table[["A"]]), "Tabulate", "No", "Clockwise", "Yes"))
+rk.header ("Pie chart", parameters=list ("Variable"=rk.get.description (test_table[["A"]]), "Orientation"="Clockwise"))
 
 rk.graph.on ()
 try ({
@@ -15,3 +15,19 @@
 })
 rk.graph.off ()
 })
+local({
+## Prepare
+## Compute
+## Print result
+groups <- rk.list (test_table[["A"]], test_table[["B"]], test_table[["C"]])
+title <- paste (names (groups), collapse=" by ")
+x <- table (interaction (groups))
+
+rk.header ("Pie chart", parameters=list ("Tabulation groups"=paste (names (groups), collapse=" by "), "Tabulation statistic"="Frequency", "Orientation"="Counter clockwise"))
+
+rk.graph.on ()
+try ({
+	pie(x, clockwise =0, main=title, sub="Frequency")
+})
+rk.graph.off ()
+})

Modified: trunk/rkward/tests/plots/piechart.rkout
===================================================================
--- trunk/rkward/tests/plots/piechart.rkout	2011-09-15 14:01:46 UTC (rev 3782)
+++ trunk/rkward/tests/plots/piechart.rkout	2011-09-15 15:12:32 UTC (rev 3783)
@@ -1,8 +1,15 @@
 <h1>Pie chart</h1>
 <h2>Parameters</h2>
 <ul><li>Variable: A</li>
-<li>Tabulate: No</li>
-<li>Clockwise: Yes</li>
+<li>Orientation: Clockwise</li>
 </ul>
 DATE<br />
 <img src="graph.png" width="480" height="480"><br>
+<h1>Pie chart</h1>
+<h2>Parameters</h2>
+<ul><li>Tabulation groups: A by B by C</li>
+<li>Tabulation statistic: Frequency</li>
+<li>Orientation: Counter clockwise</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 14:01:46 UTC (rev 3782)
+++ trunk/rkward/tests/plots.R	2011-09-15 15:12:32 UTC (rev 3783)
@@ -50,10 +50,14 @@
 			rk.call.plugin ("rkward::histogram", adjust.real="4.00", bw.string="nrd", col_density.color.string="blue", density.state="1", histogram_opt.addtoplot.state="", histogram_opt.barlabels.state="1", histogram_opt.density.real="-1.", histogram_opt.doborder.state="1", histogram_opt.freq.state="0", histogram_opt.histbordercol.color.string="", histogram_opt.histbreaksFunction.string="vec", histogram_opt.histbreaks_veclength.real="6.", histogram_opt.histlinetype.string="solid", histogram_opt.include_lowest.state="1", histogram_opt.rightclosed.state="1", histogram_opt.usefillcol.state="", n.real="512.00", narm.state="na.rm=TRUE", 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="", x.available="swiss[[\"Education\"]]", submit.mode="submit")
 		}),
 		new ("RKTest", id="pareto_chart", call=function () {
-			rk.call.plugin ("rkward::pareto", descriptives.state="TRUE", 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="", tabulate.state="FALSE", x.available="swiss[[\"Catholic\"]]", submit.mode="submit")
+			rk.call.plugin ("rkward::pareto", descriptives.state="TRUE", limit.checked="1", limit_options.cutoff.real="10.00", limit_options.include_others.checked="0", limit_options.sorting.string="largest", 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.yaxt.state="", plotoptions.ylab.text="", plotoptions.ymaxvalue.text="", plotoptions.yminvalue.text="", tabulate.checked="0", x.available="swiss[[\"Education\"]]", submit.mode="submit")
+
+			rk.call.plugin ("rkward::pareto", descriptives.state="TRUE", limit.checked="0", 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.yaxt.state="", plotoptions.ylab.text="", plotoptions.ymaxvalue.text="", plotoptions.yminvalue.text="", 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")
 		}, libraries=c("qcc", "xtable")),
 		new ("RKTest", id="piechart", call=function () {
-			rk.call.plugin ("rkward::piechart", angle.real="45.00", angle_inc.real="6.00", clockwise.state="1", colors.string="grayscale", density.real="3.00", density_inc.real="1.00", names_exp.text="names (x)", names_mode.string="default", 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="", radius.real="0.80", tabulate.state="0", x.available="test_table[[\"A\"]]", submit.mode="submit")
+			rk.call.plugin ("rkward::piechart", angle.real="45.00", angle_inc.real="6.00", clockwise.state="1", colors.string="grayscale", density.real="3.00", density_inc.real="1.00", names_exp.text="names (x)", names_mode.string="default", 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="", radius.real="0.80", tabulate.checked="0", x.available="test_table[[\"A\"]]", submit.mode="submit")
+
+			rk.call.plugin ("rkward::piechart", clockwise.state="0", colors.string="default", density.real="-1", density_inc.real="0", limit.checked="0", names_mode.string="default", 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.yaxt.state="", plotoptions.ylab.text="", radius.real="0.80", tabulate.checked="1", tabulate_options.groups.available="test_table[[\"A\"]]\ntest_table[[\"B\"]]\ntest_table[[\"C\"]]", tabulate_options.stat.string="freq", submit.mode="submit")
 		}),
 		new ("RKTest", id="scatterplot", call=function () {
 			rk.call.plugin ("rkward::scatterplot", cex.text="1", col.text="c ('black', 'red')", color.string="each", isCex.string="all", isPch.string="all", pch.text="1", 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="", pointtype.string="p", type_mode.string="all", x.available="women[[\"weight\"]]\nswiss[[\"Education\"]]", y.available="women[[\"height\"]]\nswiss[[\"Catholic\"]]", 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