[rkward-cvs] SF.net SVN: rkward: [1058] trunk/rkward/rkward/plugins/20descriptive/code. php

tfry at users.sourceforge.net tfry at users.sourceforge.net
Thu Jan 4 00:58:20 UTC 2007


Revision: 1058
          http://svn.sourceforge.net/rkward/?rev=1058&view=rev
Author:   tfry
Date:     2007-01-03 16:58:20 -0800 (Wed, 03 Jan 2007)

Log Message:
-----------
Explicitely setting the titles in the output is redundant, and can be removed by given better name to the fields

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

Modified: trunk/rkward/rkward/plugins/20descriptive/code.php
===================================================================
--- trunk/rkward/rkward/plugins/20descriptive/code.php	2007-01-04 00:18:35 UTC (rev 1057)
+++ trunk/rkward/rkward/plugins/20descriptive/code.php	2007-01-04 00:58:20 UTC (rev 1058)
@@ -14,7 +14,7 @@
 ?>
 rk.temp.options <- list (domean=<? getRK ("mean"); ?>, domedian=<? getRK ("median"); ?>, dorange=<? getRK ("range"); ?>, dosd=<? getRK ("sd"); ?>, dosum=<? getRK ("sum"); ?>, doprod=<? getRK ("prod"); ?>, domad=<? getRK ("mad"); ?>, dolength=<? getRK ("length"); ?>, donacount=<? getRK ("nacount"); ?>)
 rk.temp.vars <- list (<? echo ($vars); ?>)
-rk.temp.results <- data.frame (object=rep (NA, length (rk.temp.vars)))
+rk.temp.results <- data.frame ('Object'=rep (NA, length (rk.temp.vars)))
 i=0;
 for (rk.temp.var in rk.temp.vars) {
 	i = i+1
@@ -30,14 +30,14 @@
 			rk.temp.results$max[i] <- rk.temp.range[2]
 		})
 	}
-	if (rk.temp.options$dosd) rk.temp.results$sd[i] <- try (sd (eval (rk.temp.var), na.rm=TRUE))
+	if (rk.temp.options$dosd) rk.temp.results$'standard deviation'[i] <- try (sd (eval (rk.temp.var), na.rm=TRUE))
 	if (rk.temp.options$dosum) rk.temp.results$sum[i] <- try (sum (eval (rk.temp.var), na.rm=TRUE))
 	if (rk.temp.options$doprod) rk.temp.results$prod[i] <- try (prod (eval (rk.temp.var), na.rm=TRUE))
-	if (rk.temp.options$domad) rk.temp.results$mad[i] <- try (mad (eval (rk.temp.var), constant = <? echo ($constMad);
+	if (rk.temp.options$domad) rk.temp.results$'Median Absolute Deviation'[i] <- try (mad (eval (rk.temp.var), constant = <? echo ($constMad);
 		if ($mad_type == "low") echo (", low=TRUE");
 		elseif ($mad_type == "high") echo (", high=TRUE"); ?>, na.rm=TRUE))
-	if (rk.temp.options$dolength) rk.temp.results$length[i] <- try (length (eval (rk.temp.var)))
-	if (rk.temp.options$donacount) rk.temp.results$nacount[i] <- try (length (which(is.na(eval (rk.temp.var)))))
+	if (rk.temp.options$dolength) rk.temp.results$'length of sample'[i] <- try (length (eval (rk.temp.var)))
+	if (rk.temp.options$donacount) rk.temp.results$'number of NAs'[i] <- try (length (which(is.na(eval (rk.temp.var)))))
 }<?
 	}
 	
@@ -52,19 +52,7 @@
 						elseif ($mad_type == '"hi-median"');
 						else echo ('"average"'); ?>)))
 
-rk.results (rk.temp.results,
-	titles = c ("Object",
-		if (rk.temp.options$domean) "mean",
-		if (rk.temp.options$domedian) "median",
-		if (rk.temp.options$dorange) "min",
-		if (rk.temp.options$dorange) "max",
-		if (rk.temp.options$dosd) "standard deviation",
-		if (rk.temp.options$dosum) "sum",
-		if (rk.temp.options$doprod) "product",
-		if (rk.temp.options$domad) "mad",
-		if (rk.temp.options$dolength) "length of sample",
-		if (rk.temp.options$donacount) "number of NAs"))
-
+rk.results (rk.temp.results)
 <?
 	}
 	


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