[rkward-cvs] SF.net SVN: rkward:[4262] trunk/rkward/rkward/plugins/plots

sjar at users.sourceforge.net sjar at users.sourceforge.net
Thu May 24 20:58:59 UTC 2012


Revision: 4262
          http://rkward.svn.sourceforge.net/rkward/?rev=4262&view=rev
Author:   sjar
Date:     2012-05-24 20:58:59 +0000 (Thu, 24 May 2012)
Log Message:
-----------
* make mean work with NAs
* some code styling
* some fixes

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/plots/box_plot.js
    trunk/rkward/rkward/plugins/plots/box_plot.xml

Modified: trunk/rkward/rkward/plugins/plots/box_plot.js
===================================================================
--- trunk/rkward/rkward/plugins/plots/box_plot.js	2012-05-22 17:52:28 UTC (rev 4261)
+++ trunk/rkward/rkward/plugins/plots/box_plot.js	2012-05-24 20:58:59 UTC (rev 4262)
@@ -56,7 +56,7 @@
 	}
 	echo ('try (boxplot (data_list' + boxwex + positions + ', notch = ' + getValue ("notch") + ', outline = ' + getValue("outline") + ', horizontal = ' + getValue("orientation") + getValue ("plotoptions.code.printout") + ')) #actual boxplot function\n');
 	if (do_mean) {
-		var mean_fun = "mean";
+	    var mean_fun = "mean, na.rm=TRUE";
 		if (getValue ("type_of_mean") =="geometric_mean") {
 			echo('	geo_mean <- function (x) {prod(na.omit(x))^(1/length(na.omit(x)))}	#Calculate geometric mean\n');
 			mean_fun = "geo_mean";
@@ -72,21 +72,21 @@
 		}
 
 		if (horizontal) {
-		  echo ('	try (points(1:length(data_list) ~ sapply(data_list,' + mean_fun + '), pch=' + pch_mean + ', cex = ' + getValue ("cex_sd_mean") + getValue ("sd_mean_color.code.printout") + ')) #calculates the mean for all data and adds a point at the corresponding position\n');
+		  echo ('	try (points(1:length(data_list) ~ sapply(data_list, ' + mean_fun + '), pch=' + pch_mean + ', cex = ' + getValue ("cex_sd_mean") + getValue ("sd_mean_color.code.printout") + ')) #calculates the mean for all data and adds a point at the corresponding position\n');
 		} else {
-		  echo ('	try (points(sapply(data_list,' + mean_fun + '), pch=' + pch_mean + ', cex = ' + getValue ("cex_sd_mean") + getValue ("sd_mean_color.code.printout") + ')) #calculates the mean for all data and adds a point at the corresponding position\n');
+		  echo ('	try (points(sapply(data_list, ' + mean_fun + '), pch=' + pch_mean + ', cex = ' + getValue ("cex_sd_mean") + getValue ("sd_mean_color.code.printout") + ')) #calculates the mean for all data and adds a point at the corresponding position\n');
 		}
 	}
 
 	if (do_sd) {
-		echo ('	sd_low <- (sapply(data_list,mean,na.rm = TRUE)) - (sapply(data_list,sd,na.rm = TRUE))\n');
-		echo ('	sd_high <- (sapply(data_list,mean,na.rm = TRUE)) + (sapply(data_list,sd,na.rm = TRUE))\n');
+		echo ('	sd_low <- (sapply(data_list, mean, na.rm = TRUE)) - (sapply(data_list,sd,na.rm = TRUE))\n');
+		echo ('	sd_high <- (sapply(data_list, mean, na.rm = TRUE)) + (sapply(data_list,sd,na.rm = TRUE))\n');
 		if (horizontal) {
-			echo ('	points(1:length(data_list) ~ sd_low,pch=' + pch_sd_low + ', cex = ' + getValue ("cex_sd_mean") + getValue ("sd_mean_color.code.printout") + ')\n');
-			echo ('	points(1:length(data_list) ~ sd_high,pch=' + pch_sd_high + ', cex = ' + getValue ("cex_sd_mean") + getValue ("sd_mean_color.code.printout") + ')\n');
+			echo ('	points(1:length(data_list) ~ sd_low, pch=' + pch_sd_low + ', cex = ' + getValue ("cex_sd_mean") + getValue ("sd_mean_color.code.printout") + ')\n');
+			echo ('	points(1:length(data_list) ~ sd_high, pch=' + pch_sd_high + ', cex = ' + getValue ("cex_sd_mean") + getValue ("sd_mean_color.code.printout") + ')\n');
 		} else {
-			echo ('	points(sd_low,pch=' + pch_sd_low + ', cex = ' + getValue ("cex_sd_mean") + getValue ("sd_mean_color.code.printout") + ')\n');
-			echo ('	points(sd_high,pch=' + pch_sd_high + ', cex = ' + getValue ("cex_sd_mean") + getValue ("sd_mean_color.code.printout") + ')\n');
+			echo ('	points(sd_low, pch=' + pch_sd_low + ', cex = ' + getValue ("cex_sd_mean") + getValue ("sd_mean_color.code.printout") + ')\n');
+			echo ('	points(sd_high, pch=' + pch_sd_high + ', cex = ' + getValue ("cex_sd_mean") + getValue ("sd_mean_color.code.printout") + ')\n');
 		}
 	}
 

Modified: trunk/rkward/rkward/plugins/plots/box_plot.xml
===================================================================
--- trunk/rkward/rkward/plugins/plots/box_plot.xml	2012-05-22 17:52:28 UTC (rev 4261)
+++ trunk/rkward/rkward/plugins/plots/box_plot.xml	2012-05-24 20:58:59 UTC (rev 4262)
@@ -24,7 +24,7 @@
 
 		<connect client="type_of_mean.enabled" governor="mean.checked"/>
 		<convert id="arith_mean" mode="equals" sources="type_of_mean.string" standard="arithmetic_mean" />
-		<connect client="trim.enabled" governor="arith_mean"/>
+		<connect client="trim.visible" governor="arith_mean"/>
 		<convert id="sd_or_mean" mode="or" sources="mean.checked;sd.checked"/>
 		<connect client="size_and_color_frame.enabled" governor="sd_or_mean"/>
 	</logic>

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