[rkward-cvs] SF.net SVN: rkward:[3782] trunk/rkward
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Thu Sep 15 14:01:47 UTC 2011
Revision: 3782
http://rkward.svn.sourceforge.net/rkward/?rev=3782&view=rev
Author: tfry
Date: 2011-09-15 14:01:46 +0000 (Thu, 15 Sep 2011)
Log Message:
-----------
More test updates
Modified Paths:
--------------
trunk/rkward/rkward/plugins/plots/dotchart.js
trunk/rkward/tests/plots/boxplot_grouped.rkcommands.R
trunk/rkward/tests/plots/boxplot_grouped.rkout
trunk/rkward/tests/plots/dotchart.rkcommands.R
trunk/rkward/tests/plots/dotchart.rkout
trunk/rkward/tests/plots.R
Modified: trunk/rkward/rkward/plugins/plots/dotchart.js
===================================================================
--- trunk/rkward/rkward/plugins/plots/dotchart.js 2011-09-15 13:39:18 UTC (rev 3781)
+++ trunk/rkward/rkward/plugins/plots/dotchart.js 2011-09-15 14:01:46 UTC (rev 3782)
@@ -25,10 +25,9 @@
if (tabulate) {
echo (getValue ('tabulate_options.code.calculate'));
- echo ('x <- as.numeric (x) # dotchart() is somewhat picky about data type\n');
+ echo ('n <- names (x); x <- as.numeric (x); names (x) <- n # dotchart() is somewhat picky about data type\n');
} 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/boxplot_grouped.rkcommands.R
===================================================================
--- trunk/rkward/tests/plots/boxplot_grouped.rkcommands.R 2011-09-15 13:39:18 UTC (rev 3781)
+++ trunk/rkward/tests/plots/boxplot_grouped.rkcommands.R 2011-09-15 14:01:46 UTC (rev 3782)
@@ -9,3 +9,18 @@
try (boxplot (data_list, notch = FALSE, outline = FALSE, horizontal = TRUE)) #actual boxplot function
rk.graph.off ()
})
+local({
+## Prepare
+## Compute
+## Print result
+groups <- rk.list (datasets::warpbreaks[["tension"]], datasets::warpbreaks[["wool"]])
+data_list <- split (datasets::warpbreaks[["breaks"]], groups) #split sample by grouping variables
+# adjust width and position of boxes to achieve dodging
+dodge_size <- nlevels (interaction (datasets::warpbreaks[["tension"]]))
+box_width <- 0.80 / dodge_size
+box_positions <- (rep (1:(length (data_list) / dodge_size), each=dodge_size) + (1:dodge_size)*(box_width))
+rk.header ("Boxplot", list ("Outcome variable", rk.get.description (datasets::warpbreaks[["breaks"]]), "Grouping variable(s)", paste (names (groups), collapse=", ")))
+rk.graph.on()
+try (boxplot (data_list, boxwex=box_width, at=box_positions, xlim=c(min(box_positions)-box_width, max(box_positions)+box_width), notch = FALSE, outline = FALSE, horizontal = TRUE)) #actual boxplot function
+rk.graph.off ()
+})
Modified: trunk/rkward/tests/plots/boxplot_grouped.rkout
===================================================================
--- trunk/rkward/tests/plots/boxplot_grouped.rkout 2011-09-15 13:39:18 UTC (rev 3781)
+++ trunk/rkward/tests/plots/boxplot_grouped.rkout 2011-09-15 14:01:46 UTC (rev 3782)
@@ -5,3 +5,10 @@
</ul>
DATE<br />
<img src="graph.png" width="480" height="480"><br>
+<h1>Boxplot</h1>
+<h2>Parameters</h2>
+<ul><li>Outcome variable: breaks</li>
+<li>Grouping variable(s): tension, wool</li>
+</ul>
+DATE<br />
+<img src="graph.png" width="480" height="480"><br>
Modified: trunk/rkward/tests/plots/dotchart.rkcommands.R
===================================================================
--- trunk/rkward/tests/plots/dotchart.rkcommands.R 2011-09-15 13:39:18 UTC (rev 3781)
+++ trunk/rkward/tests/plots/dotchart.rkcommands.R 2011-09-15 14:01:46 UTC (rev 3782)
@@ -4,10 +4,10 @@
## Print result
x <- women[["height"]]
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 ("Dot chart", parameters=list ("Variable", rk.get.description (women[["height"]]), "Tabulate", "No"))
+rk.header ("Dot chart", parameters=list ("Variable"=rk.get.description (women[["height"]])))
rk.graph.on ()
try ({
@@ -20,13 +20,16 @@
## Prepare
## Compute
## Print result
-x <- table (warpbreaks[["tension"]], exclude=NULL)
+groups <- rk.list (warpbreaks[["tension"]], warpbreaks[["wool"]])
+title <- paste (names (groups), collapse=" by ")
+x <- by (warpbreaks[["breaks"]], interaction (groups), FUN=function (x) { mean (x) })
+n <- names (x); x <- as.numeric (x); names (x) <- n # dotchart() is somewhat picky about data type
-rk.header ("Dot chart", parameters=list ("Variable", rk.get.description (warpbreaks[["tension"]]), "Tabulate", "Yes"))
+rk.header ("Dot chart", parameters=list ("Tabulation groups"=paste (names (groups), collapse=" by "), "Tabulation statistic"="mean (x) of warpbreaks[[\"breaks\"]]"))
rk.graph.on ()
try ({
- dotchart(x)
+ dotchart(x, xlab="mean (x) of warpbreaks[[\"breaks\"]]", ylab=title)
})
rk.graph.off ()
})
Modified: trunk/rkward/tests/plots/dotchart.rkout
===================================================================
--- trunk/rkward/tests/plots/dotchart.rkout 2011-09-15 13:39:18 UTC (rev 3781)
+++ trunk/rkward/tests/plots/dotchart.rkout 2011-09-15 14:01:46 UTC (rev 3782)
@@ -1,14 +1,13 @@
<h1>Dot chart</h1>
<h2>Parameters</h2>
<ul><li>Variable: height</li>
-<li>Tabulate: No</li>
</ul>
DATE<br />
<img src="graph.png" width="480" height="480"><br>
<h1>Dot chart</h1>
<h2>Parameters</h2>
-<ul><li>Variable: tension</li>
-<li>Tabulate: Yes</li>
+<ul><li>Tabulation groups: tension by wool</li>
+<li>Tabulation statistic: mean (x) of warpbreaks[["breaks"]]</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 13:39:18 UTC (rev 3781)
+++ trunk/rkward/tests/plots.R 2011-09-15 14:01:46 UTC (rev 3782)
@@ -29,14 +29,16 @@
}),
new ("RKTest", id="boxplot_grouped", call=function () {
rk.call.plugin ("rkward::box_plot", data_mode.string="grouped_outcome", groups.available="warpbreaks[[\"tension\"]]\nwarpbreaks[[\"wool\"]]", mean.state="", names_exp.text="names (x)", names_mode.string="default", notch.state="FALSE", orientation.string="TRUE", outcome.available="warpbreaks[[\"breaks\"]]", outline.state="FALSE", 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="", x.available="datasets::women[[\"weight\"]]\ndatasets::women[[\"height\"]]", submit.mode="submit")
+
+ rk.call.plugin ("rkward::box_plot", boxwex.real="0.80", data_mode.string="grouped_outcome", dodges.real="1.00", groups.available="datasets::warpbreaks[[\"tension\"]]\ndatasets::warpbreaks[[\"wool\"]]", mean.state="", names_mode.string="default", notch.state="FALSE", orientation.string="TRUE", outcome.available="datasets::warpbreaks[[\"breaks\"]]", outline.state="FALSE", 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="", sd.state="", submit.mode="submit")
}),
new ("RKTest", id="density_plot", call=function () {
rk.call.plugin ("rkward::density_plot", adjust.real="1.00", bw.string="nrd0", kern.string="gaussian", n.real="512.00", narm.state="na.rm=TRUE", plot_type.string="hdr_plot", 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="", rug.state="0", x.available="women[[\"height\"]]", submit.mode="submit")
}, libraries = c ("hdrcde")),
new ("RKTest", id="dotchart", call=function () {
- rk.call.plugin ("rkward::dotchart", names_exp.text="women$weight", names_mode.string="rexp", plotoptions.add_grid.state="0", plotoptions.asp.real="0.00", plotoptions.main.text="This is a test", plotoptions.mainisquote.state="1", plotoptions.pointcolor.color.string="", plotoptions.pointtype.string="", plotoptions.sub.text="This is a subtitle", plotoptions.subisquote.state="1", 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="0", x.available="women[[\"height\"]]", submit.mode="submit")
+ rk.call.plugin ("rkward::dotchart", names_exp.text="women$weight", names_mode.string="rexp", plotoptions.add_grid.state="0", plotoptions.asp.real="0.00", plotoptions.main.text="This is a test", plotoptions.mainisquote.state="1", plotoptions.pointcolor.color.string="", plotoptions.pointtype.string="", plotoptions.sub.text="This is a subtitle", plotoptions.subisquote.state="1", 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.checked="0", x.available="women[[\"height\"]]", submit.mode="submit")
- rk.call.plugin ("rkward::dotchart", names_exp.text="names (x)", names_mode.string="default", plotoptions.add_grid.state="0", plotoptions.asp.real="0.00", plotoptions.main.text="", plotoptions.mainisquote.state="1", plotoptions.pointcolor.color.string="", plotoptions.pointtype.string="", plotoptions.sub.text="", plotoptions.subisquote.state="1", 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="1", x.available="warpbreaks[[\"tension\"]]", submit.mode="submit")
+ rk.call.plugin ("rkward::dotchart", 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.xmaxvalue.text="", plotoptions.xminvalue.text="", plotoptions.yaxt.state="", plotoptions.ylab.text="", tabulate.checked="1", tabulate_options.custom_stat.text="mean (x)", tabulate_options.groups.available="warpbreaks[[\"tension\"]]\nwarpbreaks[[\"wool\"]]", tabulate_options.outcome.available="warpbreaks[[\"breaks\"]]", tabulate_options.stat.string="custom", submit.mode="submit")
}),
new ("RKTest", id="ecdf_plot", call=function () {
rk.call.plugin ("rkward::ecdf_plot", adjust_th_pnorm.state="1", col_rug.color.string="", col_thnorm.color.string="blue", lwd.real="0.50", 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="", rug.state="1", side.string="side = 3", stepfun_options.addtoplot.state="", stepfun_options.col_hor.color.string="", stepfun_options.col_points.color.string="", stepfun_options.col_y0.color.string="", stepfun_options.col_y1.color.string="", stepfun_options.do_points.state="1", stepfun_options.linetype.string="", stepfun_options.verticals.state="", th_pnorm.state="1", ticksize.real="0.03", x.available="swiss[[\"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