~l3on/ubuntu/precise/rkward/rebuild1

« back to all changes in this revision

Viewing changes to rkward/plugins/analysis/moments/skewness_kurtosis_test.js

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Friedrichsmeier
  • Date: 2009-10-26 14:30:00 UTC
  • mfrom: (1.1.13 upstream) (6.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20091026143000-wzwt6cryjnwce23k
Tags: 0.5.2-1
* new upstream release
  closes: #551306 (added support for the new dynamic help system)
* Add "DM-Upload-Allowed: yes" in control
* bump standards version to 3.8.3 (no changes needed)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// globals
 
2
 
 
3
function preprocess () { 
 
4
echo ('require(moments)\n');
 
5
}
 
6
 
 
7
function calculate () {
 
8
        vars = "substitute (" + str_replace ("\n", "), substitute (", trim (getValue ("x"))) + ")";
 
9
        if (getValue ("narm")) narm = ", na.rm=TRUE";
 
10
        else narm = ", na.rm=FALSE"
 
11
 
 
12
 
 
13
echo ('objects <- list (' + vars + ')\n');
 
14
echo ('results <- data.frame (\'Variable Name\'=rep (NA, length (objects)), check.names=FALSE)\n');
 
15
echo ('for (i in 1:length (objects)) {\n');
 
16
echo (' var <- eval (objects[[i]], envir=globalenv ())\n');
 
17
echo (' results[i, \'Variable Name\'] <- rk.get.description (objects[[i]], is.substitute=TRUE)\n');
 
18
echo ('\n');
 
19
echo (' try ({\n');
 
20
        if (getValue ("skewness")) { 
 
21
echo ('         results[i, \'Skewness\'] <- skewness (var' + narm + ')\n');
 
22
        }
 
23
        if (getValue ("kurtosis")) { 
 
24
echo ('         results[i, \'Kurtosis\'] <- kurtosis (var' + narm + ')\n');
 
25
echo ('         results[i, \'Excess Kurtosis\'] <- results[i, \'Kurtosis\'] - 3\n');
 
26
        }
 
27
        if (getValue ("geary")) { 
 
28
echo ('         results[i, \'Geary Kurtosis\'] <- geary (var' + narm + ')\n');
 
29
        } 
 
30
echo (' })\n');
 
31
        if (getValue ("length")) { 
 
32
echo ('\n');
 
33
echo (' results[i, \'Length\'] <- length (var)\n');
 
34
echo (' results[i, \'NAs\'] <- sum (is.na(var))\n');
 
35
        } 
 
36
echo ('}\n');
 
37
}
 
38
function printout () {
 
39
echo ('rk.header ("Skewness and Kurtosis")\n');
 
40
echo ('rk.results (results)\n');
 
41
}
 
42