[rkward-cvs] SF.net SVN: rkward:[3675] trunk/rkward/rkward/plugins
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Sun Jun 5 13:27:21 UTC 2011
Revision: 3675
http://rkward.svn.sourceforge.net/rkward/?rev=3675&view=rev
Author: tfry
Date: 2011-06-05 13:27:21 +0000 (Sun, 05 Jun 2011)
Log Message:
-----------
Add a plugin for (single variable) tabulation, and make use of it in the pareto-plot.
This requires a surprisingly large amount of changes, since the plot_options-plugin did not allow non-quoted default labels, so far.
Modified Paths:
--------------
trunk/rkward/rkward/plugins/distributions/clt/plot_beta_clt.xml
trunk/rkward/rkward/plugins/distributions/clt/plot_binomial_clt.xml
trunk/rkward/rkward/plugins/distributions/clt/plot_chi_squared_clt.xml
trunk/rkward/rkward/plugins/distributions/clt/plot_clt_snippets.xml
trunk/rkward/rkward/plugins/distributions/clt/plot_exponential_clt.xml
trunk/rkward/rkward/plugins/distributions/clt/plot_f_clt.xml
trunk/rkward/rkward/plugins/distributions/clt/plot_gamma_clt.xml
trunk/rkward/rkward/plugins/distributions/clt/plot_geometric_clt.xml
trunk/rkward/rkward/plugins/distributions/clt/plot_hypergeometric_clt.xml
trunk/rkward/rkward/plugins/distributions/clt/plot_logistic_clt.xml
trunk/rkward/rkward/plugins/distributions/clt/plot_lognormal_clt.xml
trunk/rkward/rkward/plugins/distributions/clt/plot_negbinomial_clt.xml
trunk/rkward/rkward/plugins/distributions/clt/plot_normal_clt.xml
trunk/rkward/rkward/plugins/distributions/clt/plot_poisson_clt.xml
trunk/rkward/rkward/plugins/distributions/clt/plot_t_clt.xml
trunk/rkward/rkward/plugins/distributions/clt/plot_uniform_clt.xml
trunk/rkward/rkward/plugins/distributions/clt/plot_weibull_clt.xml
trunk/rkward/rkward/plugins/distributions/clt/plot_wilcoxon_clt.xml
trunk/rkward/rkward/plugins/embedded.pluginmap
trunk/rkward/rkward/plugins/plots/box_plot.xml
trunk/rkward/rkward/plugins/plots/pareto.js
trunk/rkward/rkward/plugins/plots/pareto.xml
trunk/rkward/rkward/plugins/plots/plot_options.js
trunk/rkward/rkward/plugins/plots/plot_options.rkh
Added Paths:
-----------
trunk/rkward/rkward/plugins/data/one_var_tabulation.js
trunk/rkward/rkward/plugins/data/one_var_tabulation.rkh
trunk/rkward/rkward/plugins/data/one_var_tabulation.xml
Added: trunk/rkward/rkward/plugins/data/one_var_tabulation.js
===================================================================
--- trunk/rkward/rkward/plugins/data/one_var_tabulation.js (rev 0)
+++ trunk/rkward/rkward/plugins/data/one_var_tabulation.js 2011-06-05 13:27:21 UTC (rev 3675)
@@ -0,0 +1,21 @@
+function calculate () {
+ var titlevar = getValue ("titlevar");
+ var outvar = getValue ("outvar");
+ var groups = getValue ("groups").split ("\n").join (", ");
+ var stat = getValue ("stat");
+ var fun = "length";
+ echo ('groups <- rk.list (' + groups + ')\n');
+ if (titlevar != "") echo (titlevar + ' <- paste (names (groups), collapse=" by ")\n');
+
+ if (stat == "freq") {
+ echo (outvar + ' <- table (interaction (groups))\n');
+ } else {
+ if (stat == "sum") {
+ fun = "sum";
+ } else {
+ fun = 'function (x) { ' + getValue ("custom_stat") + ' }';
+ }
+ echo (outvar + ' <- by (' + getValue ("outcome") +', interaction (groups), FUN=' + fun + ')\n');
+ }
+}
+
Added: trunk/rkward/rkward/plugins/data/one_var_tabulation.rkh
===================================================================
Added: trunk/rkward/rkward/plugins/data/one_var_tabulation.xml
===================================================================
--- trunk/rkward/rkward/plugins/data/one_var_tabulation.xml (rev 0)
+++ trunk/rkward/rkward/plugins/data/one_var_tabulation.xml 2011-06-05 13:27:21 UTC (rev 3675)
@@ -0,0 +1,55 @@
+<!DOCTYPE rkplugin>
+<document>
+ <code file="one_var_tabulation.js" />
+ <help file="one_var_tabulation.rkh" />
+ <logic>
+ <external id="outvar" default="x"/>
+ <external id="titlevar" default=""/>
+ <external id="var_label" default="x"/>
+ <external id="fun_label" default=""/>
+
+ <set id="varsource.visible" to="false"/>
+
+ <convert id="is_freq" sources="stat.string" mode="equals" standard="freq"/>
+ <connect client="outcome.enabled" governor="is_freq.not"/>
+ <convert id="is_custom" sources="stat.string" mode="equals" standard="custom"/>
+ <connect client="custom_stat.enabled" governor="is_custom"/>
+
+ <script><![CDATA[
+ gui.addChangeCommand ("stat.string", "updateFunLabel ()");
+ gui.addChangeCommand ("custom_stat.text", "updateFunLabel ()");
+ gui.addChangeCommand ("outcome.available", "updateFunLabel ()");
+ updateFunLabel = function () {
+ var stat = gui.getValue ("stat.string");
+ var label;
+ if (stat == "freq") {
+ label = "Frequency";
+ } else {
+ var obj = makeRObject (gui.getValue ("outcome.available"));
+ if (stat == "sum") {
+ label = "Sum of " + obj.objectname;
+ } else if (stat == "custom") {
+ label = gui.getValue ("custom_stat.text") + " of " + obj.objectname;
+ }
+ }
+ gui.setValue ("fun_label", quote (label));
+ }
+ updateFunLabel ();
+ ]]></script>
+ </logic>
+ <dialog label="Tabulate" >
+ <varselector id="varsource"/> <!-- dummy varselector is currently needed to allow the embedding component to connect its own varselector -->
+ <varslot min_vars="1" multi="true" id="groups" source="varsource" required="true" label="Grouping factors"/>
+ <row>
+ <radio id="stat" label="Statistic">
+ <option value="freq" checked="true" label="Frequency"/>
+ <option value="sum" label="Sum"/>
+ <option value="custom" label="Other:"/>
+ </radio>
+ <column>
+ <varslot id="outcome" source="varsource" required="true" label="Values"/>
+ <input id="custom_stat" label="Custom statistic" initial="mean (x)"/>
+ </column>
+ </row>
+ </dialog>
+</document>
Modified: trunk/rkward/rkward/plugins/distributions/clt/plot_beta_clt.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/clt/plot_beta_clt.xml 2011-06-05 13:24:07 UTC (rev 3674)
+++ trunk/rkward/rkward/plugins/distributions/clt/plot_beta_clt.xml 2011-06-05 13:27:21 UTC (rev 3675)
@@ -14,7 +14,7 @@
<logic>
<insert snippet="clt_logic"/>
<set id="dist_stepfun.default_dopoints" to="false" />
- <set id="plotoptions.default_main" to="Beta"/>
+ <set id="plotoptions.default_main" to=""Beta""/>
</logic>
<dialog label="Central Limit Theorem: Beta to Normal" >
<insert snippet="clt_layout"/>
Modified: trunk/rkward/rkward/plugins/distributions/clt/plot_binomial_clt.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/clt/plot_binomial_clt.xml 2011-06-05 13:24:07 UTC (rev 3674)
+++ trunk/rkward/rkward/plugins/distributions/clt/plot_binomial_clt.xml 2011-06-05 13:27:21 UTC (rev 3675)
@@ -14,7 +14,7 @@
<logic>
<insert snippet="clt_logic"/>
<set id="dist_stepfun.default_verticals" to="false" />
- <set id="plotoptions.default_main" to="Binomial"/>
+ <set id="plotoptions.default_main" to=""Binomial""/>
</logic>
<dialog label="Central Limit Theorem: Binomial to Normal" >
<insert snippet="clt_layout"/>
Modified: trunk/rkward/rkward/plugins/distributions/clt/plot_chi_squared_clt.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/clt/plot_chi_squared_clt.xml 2011-06-05 13:24:07 UTC (rev 3674)
+++ trunk/rkward/rkward/plugins/distributions/clt/plot_chi_squared_clt.xml 2011-06-05 13:27:21 UTC (rev 3675)
@@ -14,7 +14,7 @@
<logic>
<insert snippet="clt_logic"/>
<set id="dist_stepfun.default_dopoints" to="false" />
- <set id="plotoptions.default_main" to="Chi-Squared"/>
+ <set id="plotoptions.default_main" to=""Chi-Squared""/>
</logic>
<dialog label="Central Limit Theorem: Chi squared to Normal" >
<insert snippet="clt_layout"/>
Modified: trunk/rkward/rkward/plugins/distributions/clt/plot_clt_snippets.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/clt/plot_clt_snippets.xml 2011-06-05 13:24:07 UTC (rev 3674)
+++ trunk/rkward/rkward/plugins/distributions/clt/plot_clt_snippets.xml 2011-06-05 13:27:21 UTC (rev 3675)
@@ -6,7 +6,7 @@
<set id="plotoptions.allow_type" to="false"/>
<set id="plotoptions.allow_grid" to="true"/>
<set id="plotoptions.allow_ylim" to="false"/>
- <set id="plotoptions.default_xlab" to="Sample Averages"/>
+ <set id="plotoptions.default_xlab" to=""Sample Averages""/>
<set id="normlinecol.default_color" to="red" />
Modified: trunk/rkward/rkward/plugins/distributions/clt/plot_exponential_clt.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/clt/plot_exponential_clt.xml 2011-06-05 13:24:07 UTC (rev 3674)
+++ trunk/rkward/rkward/plugins/distributions/clt/plot_exponential_clt.xml 2011-06-05 13:27:21 UTC (rev 3675)
@@ -13,7 +13,7 @@
<logic>
<insert snippet="clt_logic"/>
<set id="dist_stepfun.default_dopoints" to="false" />
- <set id="plotoptions.default_main" to="Exponential"/>
+ <set id="plotoptions.default_main" to=""Exponential""/>
</logic>
<dialog label="Central Limit Theorem: Exponential to Normal" >
<insert snippet="clt_layout"/>
Modified: trunk/rkward/rkward/plugins/distributions/clt/plot_f_clt.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/clt/plot_f_clt.xml 2011-06-05 13:24:07 UTC (rev 3674)
+++ trunk/rkward/rkward/plugins/distributions/clt/plot_f_clt.xml 2011-06-05 13:27:21 UTC (rev 3675)
@@ -15,7 +15,7 @@
<logic>
<insert snippet="clt_logic"/>
<set id="dist_stepfun.default_dopoints" to="false" />
- <set id="plotoptions.default_main" to="F"/>
+ <set id="plotoptions.default_main" to=""F""/>
</logic>
<dialog label="Central Limit Theorem: F to Normal" >
<insert snippet="clt_layout"/>
Modified: trunk/rkward/rkward/plugins/distributions/clt/plot_gamma_clt.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/clt/plot_gamma_clt.xml 2011-06-05 13:24:07 UTC (rev 3674)
+++ trunk/rkward/rkward/plugins/distributions/clt/plot_gamma_clt.xml 2011-06-05 13:27:21 UTC (rev 3675)
@@ -14,7 +14,7 @@
<logic>
<insert snippet="clt_logic"/>
<set id="dist_stepfun.default_dopoints" to="false" />
- <set id="plotoptions.default_main" to="Gamma"/>
+ <set id="plotoptions.default_main" to=""Gamma""/>
</logic>
<dialog label="Central Limit Theorem: Gamma to Normal" >
<insert snippet="clt_layout"/>
Modified: trunk/rkward/rkward/plugins/distributions/clt/plot_geometric_clt.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/clt/plot_geometric_clt.xml 2011-06-05 13:24:07 UTC (rev 3674)
+++ trunk/rkward/rkward/plugins/distributions/clt/plot_geometric_clt.xml 2011-06-05 13:27:21 UTC (rev 3675)
@@ -13,7 +13,7 @@
<logic>
<insert snippet="clt_logic"/>
<set id="dist_stepfun.default_verticals" to="false" />
- <set id="plotoptions.default_main" to="Geometric"/>
+ <set id="plotoptions.default_main" to=""Geometric""/>
</logic>
<dialog label="Central Limit Theorem: Geometric to Normal" >
<insert snippet="clt_layout"/>
Modified: trunk/rkward/rkward/plugins/distributions/clt/plot_hypergeometric_clt.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/clt/plot_hypergeometric_clt.xml 2011-06-05 13:24:07 UTC (rev 3674)
+++ trunk/rkward/rkward/plugins/distributions/clt/plot_hypergeometric_clt.xml 2011-06-05 13:27:21 UTC (rev 3675)
@@ -15,7 +15,7 @@
<logic>
<insert snippet="clt_logic"/>
<set id="dist_stepfun.default_verticals" to="false" />
- <set id="plotoptions.default_main" to="Hypergeometric"/>
+ <set id="plotoptions.default_main" to=""Hypergeometric""/>
</logic>
<dialog label="Central Limit Theorem: Hypergeometric to Normal" >
<insert snippet="clt_layout"/>
Modified: trunk/rkward/rkward/plugins/distributions/clt/plot_logistic_clt.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/clt/plot_logistic_clt.xml 2011-06-05 13:24:07 UTC (rev 3674)
+++ trunk/rkward/rkward/plugins/distributions/clt/plot_logistic_clt.xml 2011-06-05 13:27:21 UTC (rev 3675)
@@ -14,7 +14,7 @@
<logic>
<insert snippet="clt_logic"/>
<set id="dist_stepfun.default_dopoints" to="false" />
- <set id="plotoptions.default_main" to="Logistic"/>
+ <set id="plotoptions.default_main" to=""Logistic""/>
</logic>
<dialog label="Central Limit Theorem: Logistic to Normal" >
<insert snippet="clt_layout"/>
Modified: trunk/rkward/rkward/plugins/distributions/clt/plot_lognormal_clt.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/clt/plot_lognormal_clt.xml 2011-06-05 13:24:07 UTC (rev 3674)
+++ trunk/rkward/rkward/plugins/distributions/clt/plot_lognormal_clt.xml 2011-06-05 13:27:21 UTC (rev 3675)
@@ -14,7 +14,7 @@
<logic>
<insert snippet="clt_logic"/>
<set id="dist_stepfun.default_dopoints" to="false" />
- <set id="plotoptions.default_main" to="Lognormal"/>
+ <set id="plotoptions.default_main" to=""Lognormal""/>
</logic>
<dialog label="Central Limit Theorem: Lognormal to Normal" >
<insert snippet="clt_layout"/>
Modified: trunk/rkward/rkward/plugins/distributions/clt/plot_negbinomial_clt.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/clt/plot_negbinomial_clt.xml 2011-06-05 13:24:07 UTC (rev 3674)
+++ trunk/rkward/rkward/plugins/distributions/clt/plot_negbinomial_clt.xml 2011-06-05 13:27:21 UTC (rev 3675)
@@ -26,7 +26,7 @@
<logic>
<insert snippet="clt_logic"/>
<set id="dist_stepfun.default_verticals" to="false" />
- <set id="plotoptions.default_main" to="Negative Binomial"/>
+ <set id="plotoptions.default_main" to=""Negative Binomial""/>
<convert id="useprob" mode="equals" sources="param.string" standard="pprob" />
<connect client="prob.enabled" governor="useprob" />
Modified: trunk/rkward/rkward/plugins/distributions/clt/plot_normal_clt.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/clt/plot_normal_clt.xml 2011-06-05 13:24:07 UTC (rev 3674)
+++ trunk/rkward/rkward/plugins/distributions/clt/plot_normal_clt.xml 2011-06-05 13:27:21 UTC (rev 3675)
@@ -14,7 +14,7 @@
<logic>
<insert snippet="clt_logic"/>
<set id="dist_stepfun.default_dopoints" to="false" />
- <set id="plotoptions.default_main" to="Normal"/>
+ <set id="plotoptions.default_main" to=""Normal""/>
</logic>
<dialog label="Central Limit Theorem: Normal to Normal" >
<insert snippet="clt_layout"/>
Modified: trunk/rkward/rkward/plugins/distributions/clt/plot_poisson_clt.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/clt/plot_poisson_clt.xml 2011-06-05 13:24:07 UTC (rev 3674)
+++ trunk/rkward/rkward/plugins/distributions/clt/plot_poisson_clt.xml 2011-06-05 13:27:21 UTC (rev 3675)
@@ -13,7 +13,7 @@
<logic>
<insert snippet="clt_logic"/>
<set id="dist_stepfun.default_verticals" to="false" />
- <set id="plotoptions.default_main" to="Poisson"/>
+ <set id="plotoptions.default_main" to=""Poisson""/>
</logic>
<dialog label="Central Limit Theorem: Poisson to Normal" >
<insert snippet="clt_layout"/>
Modified: trunk/rkward/rkward/plugins/distributions/clt/plot_t_clt.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/clt/plot_t_clt.xml 2011-06-05 13:24:07 UTC (rev 3674)
+++ trunk/rkward/rkward/plugins/distributions/clt/plot_t_clt.xml 2011-06-05 13:27:21 UTC (rev 3675)
@@ -14,7 +14,7 @@
<logic>
<insert snippet="clt_logic"/>
<set id="dist_stepfun.default_dopoints" to="false" />
- <set id="plotoptions.default_main" to="t"/>
+ <set id="plotoptions.default_main" to=""t""/>
</logic>
<dialog label="Central Limit Theorem: t to Normal" >
<insert snippet="clt_layout"/>
Modified: trunk/rkward/rkward/plugins/distributions/clt/plot_uniform_clt.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/clt/plot_uniform_clt.xml 2011-06-05 13:24:07 UTC (rev 3674)
+++ trunk/rkward/rkward/plugins/distributions/clt/plot_uniform_clt.xml 2011-06-05 13:27:21 UTC (rev 3675)
@@ -14,7 +14,7 @@
<logic>
<insert snippet="clt_logic"/>
<set id="dist_stepfun.default_dopoints" to="false" />
- <set id="plotoptions.default_main" to="Uniform"/>
+ <set id="plotoptions.default_main" to=""Uniform""/>
</logic>
<dialog label="Central Limit Theorem: Uniform to Normal" >
<insert snippet="clt_layout"/>
Modified: trunk/rkward/rkward/plugins/distributions/clt/plot_weibull_clt.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/clt/plot_weibull_clt.xml 2011-06-05 13:24:07 UTC (rev 3674)
+++ trunk/rkward/rkward/plugins/distributions/clt/plot_weibull_clt.xml 2011-06-05 13:27:21 UTC (rev 3675)
@@ -14,7 +14,7 @@
<logic>
<insert snippet="clt_logic"/>
<set id="dist_stepfun.default_dopoints" to="false" />
- <set id="plotoptions.default_main" to="Weibull"/>
+ <set id="plotoptions.default_main" to=""Weibull""/>
</logic>
<dialog label="Central Limit Theorem: Weibull to Normal" >
<insert snippet="clt_layout"/>
Modified: trunk/rkward/rkward/plugins/distributions/clt/plot_wilcoxon_clt.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/clt/plot_wilcoxon_clt.xml 2011-06-05 13:24:07 UTC (rev 3674)
+++ trunk/rkward/rkward/plugins/distributions/clt/plot_wilcoxon_clt.xml 2011-06-05 13:27:21 UTC (rev 3675)
@@ -14,7 +14,7 @@
<logic>
<insert snippet="clt_logic"/>
<set id="dist_stepfun.default_verticals" to="false" />
- <set id="plotoptions.default_main" to="Wilcoxon"/>
+ <set id="plotoptions.default_main" to=""Wilcoxon""/>
</logic>
<dialog label="Central Limit Theorem: Wilcoxon to Normal" >
<insert snippet="clt_layout"/>
Modified: trunk/rkward/rkward/plugins/embedded.pluginmap
===================================================================
--- trunk/rkward/rkward/plugins/embedded.pluginmap 2011-06-05 13:24:07 UTC (rev 3674)
+++ trunk/rkward/rkward/plugins/embedded.pluginmap 2011-06-05 13:27:21 UTC (rev 3675)
@@ -9,6 +9,8 @@
<component type="standard" id="histogram_options" file="plots/histogram_options.xml" label="Histogram Options" />
<component type="standard" id="barplot_embed" file="plots/barplot_embed.xml" label="Barplot Options" />
+ <component type="standard" id="one_var_tabulation" file="data/one_var_tabulation.xml" label="Tabulate" />
+
<component type="standard" id="x11grid" file="x11device/grid.xml" label="Draw Grid" />
</components>
</document>
Modified: trunk/rkward/rkward/plugins/plots/box_plot.xml
===================================================================
--- trunk/rkward/rkward/plugins/plots/box_plot.xml 2011-06-05 13:24:07 UTC (rev 3674)
+++ trunk/rkward/rkward/plugins/plots/box_plot.xml 2011-06-05 13:27:21 UTC (rev 3675)
@@ -12,19 +12,15 @@
<convert id="data_mode_grouped" mode="equals" sources="data_mode.string" standard="grouped_outcome"/>
<connect client="outcome.visible" governor="data_mode_grouped"/>
- <connect client="outcome.required" governor="data_mode_grouped"/>
<connect client="groups.visible" governor="data_mode_grouped"/>
- <connect client="groups.required" governor="data_mode_grouped"/>
<connect client="dodges.visible" governor="data_mode_grouped"/>
<connect client="x.visible" governor="data_mode_grouped.not"/>
- <connect client="x.required" governor="data_mode_grouped.not"/>
<convert id="custom_names" mode="equals" sources="names_mode.string" standard="custom"/>
<convert id="rexp_names" mode="equals" sources="names_mode.string" standard="rexp"/>
<connect client="names_custom.visible" governor="rexp_names.not"/>
<connect client="names_custom.enabled" governor="custom_names"/>
<connect client="names_exp.visible" governor="rexp_names"/>
- <connect client="names_exp.required" governor="rexp_names"/>
<connect client="pch_mean.enabled" governor="mean.state"/>
<connect client="pch_sd_high.enabled" governor="sd.state"/>
@@ -42,9 +38,9 @@
<option value="separate_vars" label="Separate variables" checked="true"/>
<option value="grouped_outcome" label="Single (grouped) variable"/>
</radio>
- <varslot multi="true" type="numeric" source="vars" id="x" label="Variable(s):"/>
- <varslot type="numeric" source="vars" id="outcome" label="Outcome variable:"/>
- <varslot multi="true" source="vars" id="groups" label="Group variable(s):"/>
+ <varslot multi="true" type="numeric" source="vars" id="x" label="Variable(s):" required="true"/>
+ <varslot type="numeric" source="vars" id="outcome" label="Outcome variable:" required="true"/>
+ <varslot multi="true" source="vars" id="groups" label="Group variable(s):" required="true"/>
<spinbox type="integer" id="dodges" label="Dodged groups" min="0" initial="0"/>
</column>
<column>
@@ -54,8 +50,8 @@
<option value="custom" label="Custom labels"/>
<option value="rexp" label="From R expression"/>
</radio>
- <input id="names_exp" label="Expression to use for labels" initial="names (x)"/>
- <input id="names_custom" label="Labels (separated by ';')" initial="First label;Second label"/>
+ <input id="names_exp" label="Expression to use for labels" initial="names (x)" required="true"/>
+ <input id="names_custom" label="Labels (separated by ';')" initial="First label;Second label" required="true"/>
</frame>
<spinbox type="real" id="boxwex" label="Box width" min="0" initial="0.8"/>
<stretch/>
Modified: trunk/rkward/rkward/plugins/plots/pareto.js
===================================================================
--- trunk/rkward/rkward/plugins/plots/pareto.js 2011-06-05 13:24:07 UTC (rev 3674)
+++ trunk/rkward/rkward/plugins/plots/pareto.js 2011-06-05 13:27:21 UTC (rev 3675)
@@ -1,35 +1,40 @@
function preprocess () {
echo ('require(qcc)\n');
- if (getValue ("descriptives")=="TRUE") {
- echo ('require(xtable)\n');
+}
+
+function calculate () {
+ if (!getValue ("tabulate")) {
+ echo ('x <- ' + getValue ("x") + '\n');
+ echo ('title <- rk.get.description (' + getValue ("x") + ')\n');
+ echo ('if (!is.numeric (x)) {\n');
+ echo (' warning ("Data may not be numeric, but proceeding as requested.\\nDid you forget to check the tabulate option?")\n');
+ echo ('}\n');
+ } else {
+ echo (getValue ('tabulate_options.code.calculate'));
}
+
+ if (getValue ("limit.checked")) {
+ echo ('max.categories <- ' + getValue ("cutoff") + '\n');
+ echo ('if (length (x) > max.categories)\n');
+ echo ('\tx <- sort (x, decreasing=TRUE)\n');
+ echo ('\tx <- c (x[1:max.categories], ' + quote (getValue ("others_label")) + '=sum (x[(cutoff+1):length(x)]))\n');
+ echo ('}\n');
+ }
}
-
function printout () {
doPrintout (true);
}
function preview () {
preprocess ();
+ calculate ();
doPrintout (false);
}
function doPrintout (full) {
- var vars = getValue ("x");
var descriptives = getValue ("descriptives")=="TRUE";
- var tabulate = getValue ("tabulate")=="TRUE";
- if (tabulate) {
- echo ('x <- table (' + vars + ', exclude=NULL)\n');
- } else {
- echo ('x <- ' + vars);
- echo ('\n');
- echo ('if (!is.numeric (x)) {\n');
- echo (' warning ("Data may not be numeric, but proceeding as requested.\\nDid you forget to check the tabulate option?")\n');
- echo ('}\n');
- }
- echo ('\n');
if (full) {
echo ('rk.header ("Pareto chart")\n');
echo ('\n');
@@ -39,7 +44,7 @@
echo ('try ({\n');
echo (' descriptives <- pareto.chart(x' + getValue ("plotoptions.code.printout") + ')\n');
if (full && descriptives) {
- echo (' rk.results(xtable(descriptives))\n');
+ echo (' rk.results(data.frame(descriptives))\n');
}
echo ('})\n');
if (full) {
Modified: trunk/rkward/rkward/plugins/plots/pareto.xml
===================================================================
--- trunk/rkward/rkward/plugins/plots/pareto.xml 2011-06-05 13:24:07 UTC (rev 3674)
+++ trunk/rkward/rkward/plugins/plots/pareto.xml 2011-06-05 13:27:21 UTC (rev 3675)
@@ -3,10 +3,25 @@
<code file="pareto.js" />
<help file="pareto.rkh" />
<logic>
- <connect client="plotoptions.default_main" governor="x.available" />
+ <set id="plotoptions.default_main" to="title" />
<set id="plotoptions.allow_type" to="false"/>
<set id="plotoptions.allow_xlim" to="false"/>
<set id="plotoptions.allow_log" to="false"/>
+
+ <connect client="tabulate_frame.enabled" governor="tabulate.state"/>
+ <connect client="x.enabled" governor="tabulate.state.not"/>
+ <connect client="tabulate_options.varsource.selected" governor="vars.selected" />
+ <set id="tabulate_options.titlevar" to="title" />
+
+ <connect client="plotoptions.default_ylab" governor="tabulate_options.fun_label" />
+ <script><![CDATA[
+ gui.addChangeCommand ("tabulate.state", "updateFunLabel ()");
+ updateFunLabel = function () {
+ var tabulate = gui.getValue ("tabulate.state");
+ if (!tabulate) gui.setValue ("tabulate_options.fun_label", quote ("Frequency"));
+ }
+ updateFunLabel ();
+ ]]></script>
</logic>
<dialog label="Pareto chart" >
<tabbook>
@@ -14,19 +29,35 @@
<row>
<varselector id="vars"/>
<column>
- <varslot min_vars="1" id="x" source="vars" required="true" label="Vector or Factor"/>
- <checkbox id="tabulate" label="Tabulate" value="TRUE" value_unchecked="FALSE" checked="false" />
- <checkbox id="descriptives" label="Print descriptives" value="TRUE" value_unchecked="FALSE" checked="true"/>
- <stretch/>
- <preview id="preview"/>
+ <checkbox id="tabulate" label="Tabulate data before plotting"/>
+ <varslot min_vars="1" id="x" source="vars" required="true" label="Vector or Factor"/>
+ <frame id="tabulate_frame">
+ <embed id="tabulate_options" component="rkward::one_var_tabulation" as_button="false" label="Tabulation Options"/>
+ </frame>
+ <checkbox id="descriptives" label="Print descriptives" value="TRUE" value_unchecked="FALSE" checked="true"/>
+ <stretch/>
+ <preview id="preview"/>
</column>
</row>
</tab>
+ <tab label="Limit" id="tab_plot_options">
+ <frame id="limit" label="Limit number of groups" checkable="true" checked="false">
+ <row>
+ <spinbox type="integer" id="cutoff" initial="1" min="1" label="Limit"/>
+ <radio id="sorting" label="Sorting">
+ <option value="lowest" label="Smallest values"/>
+ <option value="highest" checked="true" label="Largest values"/>
+ </radio>
+ </row>
+ <input id="others_label" label="Remainder category label" initial="Other" required="true"/>
+ </frame>
+ <stretch/>
+ </tab>
<tab label="Plot Options" id="tab_plot_options">
- <row>
+ <column>
<embed id="plotoptions" component="rkward::plot_options" as_button="false" label="Plot Options" />
<stretch/>
- </row>
+ </column>
</tab>
</tabbook>
</dialog>
Modified: trunk/rkward/rkward/plugins/plots/plot_options.js
===================================================================
--- trunk/rkward/rkward/plugins/plots/plot_options.js 2011-06-05 13:24:07 UTC (rev 3674)
+++ trunk/rkward/rkward/plugins/plots/plot_options.js 2011-06-05 13:27:21 UTC (rev 3675)
@@ -3,7 +3,7 @@
var label = getValue (labelname);
if (label == "") {
label = getValue ("default_" + labelname);
- quoted = true;
+ quoted = false;
}
if ((label != "") && (quoted)) label = quote (label);
if (label != "") label = ", " + labelname + "=" + label;
Modified: trunk/rkward/rkward/plugins/plots/plot_options.rkh
===================================================================
--- trunk/rkward/rkward/plugins/plots/plot_options.rkh 2011-06-05 13:24:07 UTC (rev 3674)
+++ trunk/rkward/rkward/plugins/plots/plot_options.rkh 2011-06-05 13:27:21 UTC (rev 3675)
@@ -54,7 +54,7 @@
<li><i>yvar</i>: The variable to be used for the y-coordinates.</li>
<li><i>default_pointtype</i>: A string that provides the default point type when the user chooses 'Default' for 'Type of points/lines'. The possibilities are p,l,b,o,h,s and S; the options for the <i>type</i> argument.</li>
<li><i>default_pointcolor</i>: A string that provides the default point color when the user chooses 'Default' for 'Color'. For various possibilities see the code color_chooser.xml; the options for the <i>col</i> argument.</li>
- <li><i>default_main</i>: A string specifying the <i>main</i> argument to <b>plot.default</b>. By default this is "" which means that the main title generated by the plotting function is used.</li>
+ <li><i>default_main</i>: A string specifying the <i>main</i> argument to <b>plot.default</b>. By default this is "" which means that the main title generated by the plotting function is used. Note: The default is always used unquoted. If you want to specify a literal string add quotes, explicitly, as ""e;".</li>
<li><i>default_sub</i>: Similar to <i>main</i> above but for the subtitle argument <i>sub</i>.</li>
<li><i>default_xlab</i>: Similar to <i>main</i> above but for the X-label argument <i>xlab</i>.</li>
<li><i>default_ylab</i>: Similar to <i>main</i> above but for the Y-label argument <i>ylab</i>.</li>
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