[rkward-cvs] SF.net SVN: rkward:[4088] trunk/rkward/rkward/plugins/uni1.2
sjar at users.sourceforge.net
sjar at users.sourceforge.net
Fri Dec 9 20:38:34 UTC 2011
Revision: 4088
http://rkward.svn.sourceforge.net/rkward/?rev=4088&view=rev
Author: sjar
Date: 2011-12-09 20:38:33 +0000 (Fri, 09 Dec 2011)
Log Message:
-----------
* harmonic, geometric and interquantile mean added
* option to output results to a file added (or better embed export plugin?)
Modified Paths:
--------------
trunk/rkward/rkward/plugins/uni1.2/code.js
trunk/rkward/rkward/plugins/uni1.2/description.xml
Modified: trunk/rkward/rkward/plugins/uni1.2/code.js
===================================================================
--- trunk/rkward/rkward/plugins/uni1.2/code.js 2011-12-09 18:54:16 UTC (rev 4087)
+++ trunk/rkward/rkward/plugins/uni1.2/code.js 2011-12-09 20:38:33 UTC (rev 4088)
@@ -15,6 +15,18 @@
if (getValue ("mean")) {
echo (' results[i, \'Mean\'] <- mean(var,' + narm + ')\n');
}
+ if (getValue ("geo_mean")) {
+ // compute the geometric mean
+ echo (' results[i, \'geometric mean\'] <- try (prod (na.omit(var))^(1 / length (na.omit(var))))\n');
+ }
+ if (getValue ("interquantile_mean")) {
+ // compute the quartile (25% and 75%) mean
+ echo (' results[i, \'interquantile mean\'] <- try (sum(quantile(var, probs=c(0.25), na.rm=T), quantile(var, probs=c(0.75), na.rm=TRUE)) / 2)\n');
+ }
+ if (getValue ("harmonic_mean")) {
+ // compute the harmonic mean
+ echo (' results[i, \'harmonic mean\'] <- try (1 / mean(1 / na.omit(var)))\n');
+ }
if (getValue ("vari")) {
echo (' results[i, \'Variance\'] <- var(var,' + narm + ')\n');
}
@@ -106,5 +118,6 @@
echo ('))\n');
echo ('\n');
echo ('rk.results (results)\n');
+ if (getValue ("save_to_file")) echo ('write.csv(file="' + getValue ("file") + '", results)\n');
}
Modified: trunk/rkward/rkward/plugins/uni1.2/description.xml
===================================================================
--- trunk/rkward/rkward/plugins/uni1.2/description.xml 2011-12-09 18:54:16 UTC (rev 4087)
+++ trunk/rkward/rkward/plugins/uni1.2/description.xml 2011-12-09 20:38:33 UTC (rev 4088)
@@ -27,6 +27,8 @@
<varslot multi="true" classes="numeric integer" id="z" source="vars" label="Variable" required="true" />
</row>
</column>
+ <checkbox value_unchecked="0" checked="flase" value="1" id="save_to_file" label="Save results to file" />
+ <browser type="savefile" size="small" id="file" filter="*.csv" initial="data" label="Name of the file" />
</tab>
<tab label="Statistics" >
<frame label="General" >
@@ -36,7 +38,12 @@
</frame>
<frame label="Moments" >
<row>
- <checkbox value_unchecked="0" checked="false" value="1" id="mean" label="Mean" />
+ <checkbox value_unchecked="0" checked="false" value="1" id="mean" label="Mean" />
+ <checkbox value_unchecked="0" checked="false" value="1" id="geo_mean" label="Geometric mean" />
+ <checkbox value_unchecked="0" checked="false" value="1" id="interquantile_mean" label="Interquantile mean" />
+ <checkbox value_unchecked="0" checked="false" value="1" id="harmonic_mean" label="Harmonic mean" />
+ </row>
+ <row>
<checkbox value_unchecked="0" checked="false" value="1" id="vari" label="Variance" />
<checkbox value_unchecked="0" checked="false" value="1" id="sd" label="Sd" />
</row>
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