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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Sun Jun 5 20:40:07 UTC 2011


Revision: 3676
          http://rkward.svn.sourceforge.net/rkward/?rev=3676&view=rev
Author:   tfry
Date:     2011-06-05 20:40:06 +0000 (Sun, 05 Jun 2011)

Log Message:
-----------
Documentation and fixes to r3675

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/rkward/plugin/rkpluginframe.cpp
    trunk/rkward/rkward/plugins/data/one_var_tabulation.rkh
    trunk/rkward/rkward/plugins/data/one_var_tabulation.xml
    trunk/rkward/rkward/plugins/plots/pareto.js
    trunk/rkward/rkward/plugins/plots/pareto.rkh
    trunk/rkward/rkward/plugins/plots/pareto.xml

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2011-06-05 13:27:21 UTC (rev 3675)
+++ trunk/rkward/ChangeLog	2011-06-05 20:40:06 UTC (rev 3676)
@@ -1,3 +1,8 @@
+- Pareto-plot plugin gains more tabulation options				TODO: also use in piechart; Why doesn't the Y-label update properly, when enabling / disabling tabulation?
+- rk.results() now prints rownames, where appropriate			TODO: test
+- "frame" elements in plugins can now be made checkable			TODO: document; Implement correctly, i.e. with property!
+- Disabling or hiding a plugin component makes it non-required, implicitly		TODO: remove explicit connections to component.required in the plugins. Document
+- Boxplot 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/plugin/rkpluginframe.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkpluginframe.cpp	2011-06-05 13:27:21 UTC (rev 3675)
+++ trunk/rkward/rkward/plugin/rkpluginframe.cpp	2011-06-05 20:40:06 UTC (rev 3676)
@@ -63,7 +63,6 @@
 
 	addChild ("checked", checked = new RKComponentPropertyBool (this, false, frame->isChecked (), "1", "0"));
 	connect (checked, SIGNAL (valueChanged (RKComponentPropertyBase *)), this, SLOT (propertyChanged (RKComponentPropertyBase *)));
-	checked->setInternal (true);
 }
 
 RKComponentBase* RKPluginFrame::lookupComponent (const QString& identifier, QString* remainder) {

Modified: trunk/rkward/rkward/plugins/data/one_var_tabulation.rkh
===================================================================
--- trunk/rkward/rkward/plugins/data/one_var_tabulation.rkh	2011-06-05 13:27:21 UTC (rev 3675)
+++ trunk/rkward/rkward/plugins/data/one_var_tabulation.rkh	2011-06-05 20:40:06 UTC (rev 3676)
@@ -0,0 +1,39 @@
+<!DOCTYPE rkhelp>
+<document>
+	<summary>
+		Generic tabulation plugin (single outcome vector). This plugin is designed to be embeded into other plugins.
+	</summary>
+
+	<usage>
+		Allows to tabulate frequencies, or aggregate a single variable, by the levels of one or more grouping variables.
+	</usage>
+
+	<settings>
+		<setting id="groups">Select the grouping variables. Often, these will be factors. The levels of each grouping variable will be crossed.</setting>
+		<setting id="stat">Type of tabulation / statistic to compute. This can be frequency of occurrence, or a function of a separate vector.</setting>
+		<setting id="outcome">When computing a statistic other than frequency, specify the vector containing the underlying data, here.</setting>
+		<setting id="custom_stat">When the statistic is set to "Other:", this allows you to specify an arbitrary function to compute the statistic. The function may take a vector (a sub-group of the variable selected above) as parameter "x", and must return a single numeric value. Typical examples are "mean(x)" or "sd(x)".</setting>
+	</settings>
+
+	<related>
+		<ul>
+			<li><link href="rkward://component/crosstab"/> and</li>
+			<li><link href="rkward://component/crosstab_multi"/> for tabulation of frequencies across many variables.</li>
+			<li><link href="rkward://rhelp/table"/></li>
+			<li><link href="rkward://rhelp/by"/></li>
+		</ul>
+	</related>
+
+	<technical>
+		General users may skip this section of help, this is primarily for developers.
+
+		The following external tags are provided for use in the embedding plugin.
+		<ul>
+			<li><i>outvar</i>: By default, the plugin produces a table in a variable called "x". You can set it to use a different name, here.</li>
+			<li><i>titlevar</i>: If you want the plugin to save a description of the grouping variables in an R variable, set this to an object name to use. Defaults to "", i.e. disabled.</li>
+			<li><i>fun_label</i>: This property will be set to a description of the statistic.</li>
+		</ul>
+		The generated code is available from <i>code.calculate</i>.
+	</technical>
+
+</document>

Modified: trunk/rkward/rkward/plugins/data/one_var_tabulation.xml
===================================================================
--- trunk/rkward/rkward/plugins/data/one_var_tabulation.xml	2011-06-05 13:27:21 UTC (rev 3675)
+++ trunk/rkward/rkward/plugins/data/one_var_tabulation.xml	2011-06-05 20:40:06 UTC (rev 3676)
@@ -5,7 +5,6 @@
 	<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"/>

Modified: trunk/rkward/rkward/plugins/plots/pareto.js
===================================================================
--- trunk/rkward/rkward/plugins/plots/pareto.js	2011-06-05 13:27:21 UTC (rev 3675)
+++ trunk/rkward/rkward/plugins/plots/pareto.js	2011-06-05 20:40:06 UTC (rev 3676)
@@ -3,7 +3,7 @@
 }
 
 function calculate () {
-	if (!getValue ("tabulate")) {
+	if (!getValue ("tabulate.checked")) {
 		echo ('x <- ' + getValue ("x") + '\n');
 		echo ('title <- rk.get.description (' + getValue ("x") + ')\n');
 		echo ('if (!is.numeric (x)) {\n');
@@ -15,9 +15,11 @@
 
 	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 ('if (length (x) > max.categories) {\n');
+		echo ('\tx <- sort (x');
+		if (getValue ("sorting") != "lowest") echo (', decreasing=TRUE');
+		echo (')\n');
+		echo ('\tx <- c (x[1:max.categories], ' + quote (getValue ("others_label")) + '=sum (x[(max.categories+1):length(x)]))\n');
 		echo ('}\n');
 	}
 }

Modified: trunk/rkward/rkward/plugins/plots/pareto.rkh
===================================================================
--- trunk/rkward/rkward/plugins/plots/pareto.rkh	2011-06-05 13:27:21 UTC (rev 3675)
+++ trunk/rkward/rkward/plugins/plots/pareto.rkh	2011-06-05 20:40:06 UTC (rev 3676)
@@ -10,16 +10,21 @@
 
 	<settings>
 		<caption id="tab_variables"/>
-		<setting id="x">Select a data vector or a factor to be plotted.</setting>
-		<setting id="tabulate">Whether to tabulate the data before plotting. You will generally use this, if a vector contains raw observations instead of counts of different categories.</setting>
+		<setting id="tabulate">If your data needs to be tabulated / aggregated before plotting, check this option. Refer to <link href="rkward://component/one_var_tabulation"/> for details on the dependent options.</setting>
+		<setting id="x">If your data is already contains defect counts or defect costs, or other data suitable for direct display in a pareto chart, specify it here. Otherwise, leave this empty, and check the "Tabulate" option, above.</setting>
 		<setting id="descriptives">Whether to print the frequency, cumulative frequency, percentage and cumulative percentage below the plot in the output window.</setting>
+		<caption id="tab_limit_options"/>
+		<setting id="limit">If there are very many categories in your data, it may make sense to limit the amount of categories that will be displayed. Check this, if you want to set a limit.</setting>
+		<setting id="cutoff">Maximum number of regular groups to display. One additonal group "others" will be displayed, if appropriate.</setting>
+		<setting id="sorting">Should the largest or the lowest values be kept? For a pareto chart, you will almost certainly want to keep the largest values.</setting>
+		<setting id="others_label">Allows to customize the label for the "others" category.</setting>
 		<caption id="tab_plot_options"/>
 		<setting id="plotoptions">Further options for the plot. Refer to <link href="rkward://component/plot_options"/> for details.</setting>
 	</settings>
 	<related>
 		<ul>
 			<li><link href="rkward://rhelp/pareto.chart"/></li>
-			<li><link href="rkward://rhelp/table"/></li>
+			<li><link href="rkward://component/one_var_tabulation"/></li>
 		</ul>
 	</related>
 </document>

Modified: trunk/rkward/rkward/plugins/plots/pareto.xml
===================================================================
--- trunk/rkward/rkward/plugins/plots/pareto.xml	2011-06-05 13:27:21 UTC (rev 3675)
+++ trunk/rkward/rkward/plugins/plots/pareto.xml	2011-06-05 20:40:06 UTC (rev 3676)
@@ -8,16 +8,15 @@
 		<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="x.enabled" governor="tabulate.checked.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 ()");
+			gui.addChangeCommand ("tabulate.checked", "updateFunLabel ()");
 			updateFunLabel = function () {
-				var tabulate = gui.getValue ("tabulate.state");
+				var tabulate = gui.getValue ("tabulate.checked");
 				if (!tabulate) gui.setValue ("tabulate_options.fun_label", quote ("Frequency"));
 			}
 			updateFunLabel ();
@@ -29,21 +28,21 @@
 				<row>
 					<varselector id="vars"/>
 					<column>
-						<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">
+						<frame id="tabulate" label="Tabulate data before plotting" checkable="true" checked="false">
 							<embed id="tabulate_options" component="rkward::one_var_tabulation" as_button="false" label="Tabulation Options"/>
 						</frame>
+						<varslot min_vars="1" id="x" source="vars" required="true" label="Raw vector to plot"/>
+						<stretch/>
 						<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">
+			<tab label="Limit" id="tab_limit_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"/>
+						<spinbox type="integer" id="cutoff" initial="10" min="1" label="Limit"/>
 						<radio id="sorting" label="Sorting">
 							<option value="lowest" label="Smallest values"/>
 							<option value="highest" checked="true" label="Largest values"/>


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