[rkward-cvs] SF.net SVN: rkward:[2980] trunk/rkward/rkward/plugins/plots/box_plot.js
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Tue Aug 31 10:52:49 UTC 2010
Revision: 2980
http://rkward.svn.sourceforge.net/rkward/?rev=2980&view=rev
Author: tfry
Date: 2010-08-31 10:52:48 +0000 (Tue, 31 Aug 2010)
Log Message:
-----------
Fix for mean and sd plot additions in case of varying object lengths (as pointed out by sjar)
Modified Paths:
--------------
trunk/rkward/rkward/plugins/plots/box_plot.js
Modified: trunk/rkward/rkward/plugins/plots/box_plot.js
===================================================================
--- trunk/rkward/rkward/plugins/plots/box_plot.js 2010-08-31 10:51:01 UTC (rev 2979)
+++ trunk/rkward/rkward/plugins/plots/box_plot.js 2010-08-31 10:52:48 UTC (rev 2980)
@@ -40,21 +40,21 @@
}
echo ('try (boxplot (data_list, notch = ' + getValue ("notch") + ', outline = ' + getValue("outline") + ', horizontal = ' + getValue("orientation") + getValue ("plotoptions.code.printout") + ')) #actuall boxplot function\n');
if ((mean == "TRUE") && (horizontal == "TRUE")) {
- echo (' try (points(1:length(data_list) ~ apply(data.frame(' + xvarsstring + '),2,mean,na.rm = TRUE),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,na.rm = TRUE),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 ((mean == "TRUE") && (horizontal == "FALSE")) {
- echo (' try (points(apply(data.frame(' + xvarsstring + '),2,mean,na.rm = TRUE),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,na.rm = TRUE),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 ((sd == "TRUE") && (horizontal == "FALSE")) {
- echo (' sd_low <- (apply(data.frame(' + xvarsstring + '),2,mean,na.rm = TRUE)) - (apply(data.frame(' + xvarsstring + '),2,sd,na.rm = TRUE))\n');
- echo (' sd_high <- (apply(data.frame(' + xvarsstring + '),2,mean,na.rm = TRUE)) + (apply(data.frame(' + xvarsstring + '),2,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');
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');
}
if ((sd == "TRUE") && (horizontal == "TRUE")) {
- echo (' sd_low <- (apply(data.frame(' + xvarsstring + '),2,mean,na.rm = TRUE)) - (apply(data.frame(' + xvarsstring + '),2,sd,na.rm = TRUE))\n');
- echo (' sd_high <- (apply(data.frame(' + xvarsstring + '),2,mean,na.rm = TRUE)) + (apply(data.frame(' + xvarsstring + '),2,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');
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');
}
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