[rkward-cvs] SF.net SVN: rkward: [925] trunk/rkward/rkward/plugins/20descriptive

tfry at users.sourceforge.net tfry at users.sourceforge.net
Wed Nov 15 14:33:53 UTC 2006


Revision: 925
          http://svn.sourceforge.net/rkward/?rev=925&view=rev
Author:   tfry
Date:     2006-11-15 06:33:52 -0800 (Wed, 15 Nov 2006)

Log Message:
-----------
several improvements to distributions plugin (sjar)

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/20descriptive/code.php
    trunk/rkward/rkward/plugins/20descriptive/description.xml

Modified: trunk/rkward/rkward/plugins/20descriptive/code.php
===================================================================
--- trunk/rkward/rkward/plugins/20descriptive/code.php	2006-11-15 14:20:40 UTC (rev 924)
+++ trunk/rkward/rkward/plugins/20descriptive/code.php	2006-11-15 14:33:52 UTC (rev 925)
@@ -5,6 +5,7 @@
 	function calculate () {
 		$vars = "substitute (" . str_replace ("\n", "), substitute (", trim (getRK_val ("x"))) . ")";
 		$trim = getRK_val ("trim"); //the fraction (0 to 0.5) of observations to be trimmed from each end of x before the mean is computed
+		$constMad = getRK_val ("constMad");
 		$low = getRK_val ("low");
 		$high = getRK_val ("high");
 
@@ -15,13 +16,13 @@
 	i = i+1
 	rk.temp.results[[i]] <- list ()
 	rk.temp.results[[i]]$object <- rk.get.description (var, is.substitute=TRUE)
-	if (rk.temp.options$domean) try (rk.temp.results[[i]]$mean <- mean (eval (var), <?echo ($trim) ;?>, na.rm=TRUE))
+	if (rk.temp.options$domean) try (rk.temp.results[[i]]$mean <- mean (eval (var), trim = <?echo ($trim) ;?>, na.rm=TRUE))
 	if (rk.temp.options$domedian) try (rk.temp.results[[i]]$median <- median (eval (var), na.rm=TRUE))
 	if (rk.temp.options$dorange) try (rk.temp.results[[i]]$range <- range (eval (var), na.rm=TRUE))
 	if (rk.temp.options$dosd) try (rk.temp.results[[i]]$sd <- sd (eval (var), na.rm=TRUE))
 	if (rk.temp.options$dosum) try (rk.temp.results[[i]]$sum <- sum (eval (var), na.rm=TRUE))
 	if (rk.temp.options$doprod) try (rk.temp.results[[i]]$prod <- prod (eval (var), na.rm=TRUE))
-	if (rk.temp.options$domad) try (rk.temp.results[[i]]$mad <- mad (eval (var), <?echo ($low) ;?>, <?echo ($high) ;?>, na.rm=TRUE))
+	if (rk.temp.options$domad) try (rk.temp.results[[i]]$mad <- mad (eval (var), constant = <?echo ($constMad) ;?>, <?echo ($low) ;?>, <?echo ($high) ;?>, na.rm=TRUE))
 	if (rk.temp.options$dolength) try (rk.temp.results[[i]]$length <- length (eval (var)))
 	if (rk.temp.options$donacount) try (rk.temp.results[[i]]$nacount <- length (which(is.na(eval (var)))))
 }<?

Modified: trunk/rkward/rkward/plugins/20descriptive/description.xml
===================================================================
--- trunk/rkward/rkward/plugins/20descriptive/description.xml	2006-11-15 14:20:40 UTC (rev 924)
+++ trunk/rkward/rkward/plugins/20descriptive/description.xml	2006-11-15 14:33:52 UTC (rev 925)
@@ -1,52 +1,63 @@
 <!DOCTYPE rkplugin>
-<!-- This is a simple example, of how a "plugin" might be configured. --><document>
-  <code file="code.php" />
-  <dialog label="Descriptive Statistics" >
-    <row>
-      <column>
-        <varselector id="vars" />
-      </column>
-      <column>
-        <varslot multi="true" type="numeric" source="vars" id="x" label="variable(s):" required="true" />
-      </column>
-    </row>
-    <row>
-      <column>
-        <frame label="Mean" >
-          <checkbox value_unchecked="0" checked="true" value="1" id="mean" label="mean" />
-          <spinbox type="real" initial="0" min="0" id="trim" max="0.5" label="trim" />
-        </frame>
-        <stretch/>
-        <frame label="Median, Range and Standard Deviation" >
-          <checkbox value_unchecked="0" value="1" id="median" label="median" />
-          <checkbox value_unchecked="0" checked="true" value="1" id="range" label="range" />
-          <checkbox value_unchecked="0" checked="true" value="1" id="sd" label="standard deviation" />
-        </frame>
-        <stretch/>
-      </column>
-      <column>
-        <frame label="Median Absolute Deviation (mad)" >
-          <checkbox value_unchecked="0" value="1" id="mad" label="mad" />
-          <radio id="low" label="lo-median" >
-              <option value="low = FALSE" label="FALSE" />
-              <option value="low = TRUE" label="TRUE" />
-          </radio>
-          <radio id="high" label="hi-median" >
-              <option value="high = FALSE" label="FALSE" />
-              <option value="high = TRUE" label="TRUE" />
-          </radio>
-        </frame>
-        <stretch/>
-      </column>
-      <column>
-        <frame label="Sum, Product and Length" >
-          <checkbox value_unchecked="0" value="1" id="sum" label="sum" />
-          <checkbox value_unchecked="0" value="1" id="prod" label="prod" />
-          <checkbox value_unchecked="0" value="1" id="length" label="length" />
-          <checkbox value_unchecked="0" value="1" id="nacount" label="Na count" />
-        </frame>
-        <stretch/>
-      </column>
-    </row>
-  </dialog>
+<!-- This is a simple example, of how a "plugin" might be configured. -->
+<document>
+	<code file="code.php" />
+	<dialog label="Descriptive Statistics" >
+		<tabbook>
+			<tab label="Variables">
+				<row>
+					<column>
+						<varselector id="vars" />
+					</column>
+					<column>
+						<varslot multi="true" type="numeric" source="vars" id="x" label="variable(s):" required="true" />
+					</column>
+				</row>
+			</tab>
+			<tab label="Mean Standard Deviation">				
+				<column>
+					<checkbox value_unchecked="0" checked="true" value="1" id="mean" label="mean" />
+					<spinbox type="real" initial="0" min="0" id="trim" max="0.5" label="trim" />
+				</column>
+				<column>
+					<checkbox value_unchecked="0" checked="true" value="1" id="sd" label="standard deviation" />
+				</column>
+				<stretch/>
+			</tab>
+			<tab label="Median, MAD">
+				<column>
+					<frame label="Median, Range" >
+						<checkbox value_unchecked="0" value="1" id="median" label="median" />
+					</frame>
+					<frame label="Median Absolute Deviation (mad)" >
+						<checkbox value_unchecked="0" value="1" id="mad" label="mad" />
+						<spinbox type="real" initial="1.4628" id="constMad" label="Constant" />
+						<radio id="low" label="lo-median" >
+							<option value="low = FALSE" label="FALSE" />
+							<option value="low = TRUE" label="TRUE" />
+						</radio>
+						<radio id="high" label="hi-median" >
+							<option value="high = FALSE" label="FALSE" />
+							<option value="high = TRUE" label="TRUE" />
+						</radio>
+					</frame>
+					<stretch/>
+				</column>
+			</tab>
+			<tab label="Range, Sum, Product and Length">
+				<row>
+					<column>
+						<frame>
+							<checkbox value_unchecked="0" checked="true" value="1" id="range" label="range" />
+							<checkbox value_unchecked="0" value="1" id="sum" label="sum" />
+							<checkbox value_unchecked="0" value="1" id="prod" label="prod" />
+							<checkbox value_unchecked="0" value="1" id="length" label="length" />
+							<checkbox value_unchecked="0" value="1" id="nacount" label="Na count" />
+						</frame>
+						<stretch/>
+					</column>
+				</row>
+			</tab>
+		</tabbook>
+	</dialog>
 </document>


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