[rkward-cvs] SF.net SVN: rkward:[3638] trunk/rkward
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Sat May 28 12:32:53 UTC 2011
Revision: 3638
http://rkward.svn.sourceforge.net/rkward/?rev=3638&view=rev
Author: tfry
Date: 2011-05-28 12:32:52 +0000 (Sat, 28 May 2011)
Log Message:
-----------
Finish the substitute()->rk.list() conversion.
Modified Paths:
--------------
trunk/rkward/rkward/plugins/analysis/TESTS/PP_test.js
trunk/rkward/rkward/plugins/analysis/corr_matrix.js
trunk/rkward/rkward/plugins/analysis/moments/agostino_test.js
trunk/rkward/rkward/plugins/analysis/moments/anscombe_test.js
trunk/rkward/rkward/plugins/analysis/moments/bonett_test.js
trunk/rkward/rkward/plugins/analysis/moments/moment.js
trunk/rkward/rkward/plugins/analysis/moments/skewness_kurtosis_test.js
trunk/rkward/rkward/plugins/analysis/outliers/chisq_out_test.js
trunk/rkward/rkward/plugins/analysis/outliers/dixon_test.js
trunk/rkward/rkward/plugins/analysis/outliers/grubbs_test.js
trunk/rkward/rkward/plugins/analysis/outliers/outlier.js
trunk/rkward/rkward/plugins/analysis/time_series/Box_test.js
trunk/rkward/rkward/plugins/analysis/time_series/kpss_test.js
trunk/rkward/rkward/plugins/uni1.2/code.js
trunk/rkward/tests/analysis_plugins/RKTestStandard.agostino_test.rkcommands.R
trunk/rkward/tests/analysis_plugins/RKTestStandard.anscombe_test.rkcommands.R
trunk/rkward/tests/analysis_plugins/RKTestStandard.basic_statistics_a.rkcommands.R
trunk/rkward/tests/analysis_plugins/RKTestStandard.basic_statistics_b.rkcommands.R
trunk/rkward/tests/analysis_plugins/RKTestStandard.bonett_test.rkcommands.R
trunk/rkward/tests/analysis_plugins/RKTestStandard.box_test.rkcommands.R
trunk/rkward/tests/analysis_plugins/RKTestStandard.chisq_out_test.rkcommands.R
trunk/rkward/tests/analysis_plugins/RKTestStandard.correlation_matrix.rkcommands.R
trunk/rkward/tests/analysis_plugins/RKTestStandard.dixon_test.rkcommands.R
trunk/rkward/tests/analysis_plugins/RKTestStandard.grubbs_test.rkcommands.R
trunk/rkward/tests/analysis_plugins/RKTestStandard.kpss_test.rkcommands.R
trunk/rkward/tests/analysis_plugins/RKTestStandard.moments_moment.rkcommands.R
trunk/rkward/tests/analysis_plugins/RKTestStandard.outlier.rkcommands.R
trunk/rkward/tests/analysis_plugins/RKTestStandard.pp_test.rkcommands.R
trunk/rkward/tests/analysis_plugins/RKTestStandard.skewness_kurtosis.rkcommands.R
Modified: trunk/rkward/rkward/plugins/analysis/TESTS/PP_test.js
===================================================================
--- trunk/rkward/rkward/plugins/analysis/TESTS/PP_test.js 2011-05-27 13:19:37 UTC (rev 3637)
+++ trunk/rkward/rkward/plugins/analysis/TESTS/PP_test.js 2011-05-28 12:32:52 UTC (rev 3638)
@@ -1,11 +1,10 @@
function calculate () {
- var vars = "substitute (" + trim (getValue ("x")).replace (/\n/g, "), substitute (") + ")";
+ var vars = trim (getValue ("x"));
- echo ('objects <- list (' + vars + ')\n');
- echo ('results <- data.frame (\'Variable Name\'=rep (NA, length (objects)), check.names=FALSE)\n');
- echo ('for (i in 1:length (objects)) {\n');
- echo (' results[i, \'Variable Name\'] <- rk.get.description (objects[[i]], is.substitute=TRUE)\n');
- echo (' var <- eval (objects[[i]], envir=globalenv ())\n');
+ echo ('vars <- rk.list (' + vars.split ("\n").join (", ") + ')\n');
+ echo ('results <- data.frame (\'Variable Name\'=I(names (vars)), check.names=FALSE)\n');
+ echo ('for (i in 1:length (vars)) {\n');
+ echo (' var <- vars[[i]]\n');
if (getValue ("length")) {
echo (' results[i, \'Length\'] <- length (var)\n');
echo (' results[i, \'NAs\'] <- sum (is.na(var))\n');
Modified: trunk/rkward/rkward/plugins/analysis/corr_matrix.js
===================================================================
--- trunk/rkward/rkward/plugins/analysis/corr_matrix.js 2011-05-27 13:19:37 UTC (rev 3637)
+++ trunk/rkward/rkward/plugins/analysis/corr_matrix.js 2011-05-28 12:32:52 UTC (rev 3638)
@@ -7,7 +7,7 @@
do_p = getValue ("do_p");
var exclude_whole = "";
- var vars = "substitute (" + str_replace ("\n", "), substitute (", trim (getValue ("x"))) + ")";
+ var vars = trim (getValue ("x"));
use = getValue ("use");
if (use == "pairwise") {
exclude_whole = false;
@@ -18,17 +18,15 @@
}
method = "\"" + getValue ("method") + "\"";
- echo ('objects <- list (' + vars + ')\n');
- echo ('\n');
echo ('# cor requires all objects to be inside the same data.frame.\n');
echo ('# Here we construct such a temporary frame from the input variables\n');
- echo ('data <- data.frame (lapply (objects, function (x) eval (x, envir=globalenv ())))\n');
+ echo ('data <- as.data.frame (rk.list (' + vars.split ("\n").join (", ") + '), check.names=FALSE)\n');
echo ('\n');
echo ('# calculate correlation matrix\n');
echo ('result <- cor (data, use=' + use + ', method=' + method + ')\n');
if (do_p) {
echo ('# calculate matrix of probabilities\n');
- echo ('result.p <- matrix (nrow = length (data), ncol = length (data))\n');
+ echo ('result.p <- matrix (nrow = length (data), ncol = length (data), dimnames=list (names (data), names (data)))\n');
if (exclude_whole) {
echo ('# as we need to do pairwise comparisons for technical reasons,\n');
echo ('# we need to exclude incomplete cases first to match the use="complete.obs" parameter to cor()\n');
@@ -49,12 +47,9 @@
function printout () {
echo ('rk.header ("Correlation Matrix", parameters=list ("Method", ' + method + ', "Exclusion", ' + use + '))\n');
echo ('\n');
- echo ('result <- data.frame (I (sapply (objects, FUN=function (x) rk.get.description (x, is.substitute=TRUE))), as.data.frame (result))\n');
- echo ('rk.results (result, titles=c (\'Coefficient\', sapply (objects, rk.get.short.name)))\n');
- echo ('\n');
+ echo ('rk.results (data.frame ("Coefficient"=I(names (data)), result, check.names=FALSE))\n');
if (do_p) {
- echo ('result.p <- data.frame (I (sapply (objects, FUN=function (x) rk.get.description (x, is.substitute=TRUE))), as.data.frame (result.p))\n');
- echo ('rk.results (result.p, titles=c (\'n \\\\ p\', sapply (objects, rk.get.short.name)))\n');
+ echo ('rk.results (data.frame ("n \\\\ p"=I(names (data)), result.p, check.names=FALSE))\n');
}
}
Modified: trunk/rkward/rkward/plugins/analysis/moments/agostino_test.js
===================================================================
--- trunk/rkward/rkward/plugins/analysis/moments/agostino_test.js 2011-05-27 13:19:37 UTC (rev 3637)
+++ trunk/rkward/rkward/plugins/analysis/moments/agostino_test.js 2011-05-28 12:32:52 UTC (rev 3638)
@@ -6,16 +6,13 @@
}
function calculate () {
- var vars = "substitute (" + trim (getValue ("x")).replace (/\n/g, "), substitute (") + ")";
alternative = getValue ("alternative");
+ var vars = trim (getValue ("x"));
- echo ('\n');
- echo ('vars <- list (' + vars + ')\n');
- echo ('results <- data.frame (\'Variable Name\'=rep (NA, length (vars)), check.names=FALSE)\n');
- echo ('\n');
- echo ('for (i in 1:length(vars)) {\n');
- echo (' results[i, \'Variable Name\'] <- rk.get.description (vars[[i]], is.substitute=TRUE)\n');
- echo (' var <- eval (vars[[i]], envir=globalenv ())\n');
+ echo ('vars <- rk.list (' + vars.split ("\n").join (", ") + ')\n');
+ echo ('results <- data.frame (\'Variable Name\'=I(names (vars)), check.names=FALSE)\n');
+ echo ('for (i in 1:length (vars)) {\n');
+ echo (' var <- vars[[i]]\n');
echo (' results[i, \'Error\'] <- tryCatch ({\n');
echo (' # This is the core of the calculation\n');
echo (' t <- agostino.test (var, alternative = "' + alternative + '")\n');
Modified: trunk/rkward/rkward/plugins/analysis/moments/anscombe_test.js
===================================================================
--- trunk/rkward/rkward/plugins/analysis/moments/anscombe_test.js 2011-05-27 13:19:37 UTC (rev 3637)
+++ trunk/rkward/rkward/plugins/analysis/moments/anscombe_test.js 2011-05-28 12:32:52 UTC (rev 3638)
@@ -6,15 +6,13 @@
}
function calculate () {
- var vars = "substitute (" + trim (getValue ("x")).replace (/\n/g, "), substitute (") + ")";
alternative = getValue ("alternative");
+ var vars = trim (getValue ("x"));
- echo ('vars <- list (' + vars + ')\n');
- echo ('results <- data.frame (\'Variable Name\'=rep (NA, length (vars)), check.names=FALSE)\n');
- echo ('\n');
- echo ('for (i in 1:length(vars)) {\n');
- echo (' results[i, \'Variable Name\'] <- rk.get.description (vars[[i]], is.substitute=TRUE)\n');
- echo (' var <- eval (vars[[i]], envir=globalenv ())\n');
+ echo ('vars <- rk.list (' + vars.split ("\n").join (", ") + ')\n');
+ echo ('results <- data.frame (\'Variable Name\'=I(names (vars)), check.names=FALSE)\n');
+ echo ('for (i in 1:length (vars)) {\n');
+ echo (' var <- vars[[i]]\n');
echo (' results[i, \'Error\'] <- tryCatch ({\n');
echo (' t <- anscombe.test (var, alternative = "' + alternative + '")\n');
echo (' results[i, \'Kurtosis estimator (tau)\'] <- t$statistic["kurt"]\n');
Modified: trunk/rkward/rkward/plugins/analysis/moments/bonett_test.js
===================================================================
--- trunk/rkward/rkward/plugins/analysis/moments/bonett_test.js 2011-05-27 13:19:37 UTC (rev 3637)
+++ trunk/rkward/rkward/plugins/analysis/moments/bonett_test.js 2011-05-28 12:32:52 UTC (rev 3638)
@@ -6,16 +6,13 @@
}
function calculate () {
- var vars = "substitute (" + trim (getValue ("x")).replace (/\n/g, "), substitute (") + ")";
alternative = getValue ("alternative");
+ var vars = trim (getValue ("x"));
- echo ('\n');
- echo ('vars <- list (' + vars + ')\n');
- echo ('results <- data.frame (\'Variable Name\'=rep (NA, length (vars)), check.names=FALSE)\n');
- echo ('\n');
- echo ('for (i in 1:length(vars)) {\n');
- echo (' results[i, \'Variable Name\'] <- rk.get.description (vars[[i]], is.substitute=TRUE)\n');
- echo (' var <- eval (vars[[i]], envir=globalenv ())\n');
+ echo ('vars <- rk.list (' + vars.split ("\n").join (", ") + ')\n');
+ echo ('results <- data.frame (\'Variable Name\'=I(names (vars)), check.names=FALSE)\n');
+ echo ('for (i in 1:length (vars)) {\n');
+ echo (' var <- vars[[i]]\n');
echo (' results[i, \'Error\'] <- tryCatch ({\n');
echo (' t <- bonett.test (var, alternative = "' + alternative + '")\n');
echo (' results[i, \'Kurtosis estimator (tau)\'] <- t$statistic["tau"]\n');
Modified: trunk/rkward/rkward/plugins/analysis/moments/moment.js
===================================================================
--- trunk/rkward/rkward/plugins/analysis/moments/moment.js 2011-05-27 13:19:37 UTC (rev 3637)
+++ trunk/rkward/rkward/plugins/analysis/moments/moment.js 2011-05-28 12:32:52 UTC (rev 3638)
@@ -3,15 +3,12 @@
}
function calculate () {
- var vars = "substitute (" + trim (getValue ("x")).replace (/\n/g, "), substitute (") + ")";
+ var vars = trim (getValue ("x"));
- echo ('\n');
- echo ('objects <- list (' + vars + ')\n');
- echo ('results <- data.frame (\'Variable Name\'=rep (NA, length (objects)), check.names=FALSE)\n');
- echo ('for (i in 1:length (objects)) {\n');
- echo (' var <- eval (objects[[i]], envir=globalenv ())\n');
- echo (' results[i, \'Variable Name\'] <- rk.get.description (objects[[i]], is.substitute=TRUE)\n');
- echo ('\n');
+ echo ('vars <- rk.list (' + vars.split ("\n").join (", ") + ')\n');
+ echo ('results <- data.frame (\'Variable Name\'=I(names (vars)), check.names=FALSE)\n');
+ echo ('for (i in 1:length (vars)) {\n');
+ echo (' var <- vars[[i]]\n');
echo (' try (results[i, \'Moment\'] <- moment (var, order = ' + getValue ("order") + ', central = ' + getValue ("central") + ', absolute = ' + getValue ("absolute") + ', na.rm = ' + getValue ("narm") + '))\n');
if (getValue ("length")) {
echo ('\n');
Modified: trunk/rkward/rkward/plugins/analysis/moments/skewness_kurtosis_test.js
===================================================================
--- trunk/rkward/rkward/plugins/analysis/moments/skewness_kurtosis_test.js 2011-05-27 13:19:37 UTC (rev 3637)
+++ trunk/rkward/rkward/plugins/analysis/moments/skewness_kurtosis_test.js 2011-05-28 12:32:52 UTC (rev 3638)
@@ -3,17 +3,14 @@
}
function calculate () {
- var vars = "substitute (" + trim (getValue ("x")).replace (/\n/g, "), substitute (") + ")";
- var narm = "";
+ var narm = ", na.rm=FALSE";
if (getValue ("narm")) narm = ", na.rm=TRUE";
- else narm = ", na.rm=FALSE";
+ var vars = trim (getValue ("x"));
- echo ('objects <- list (' + vars + ')\n');
- echo ('results <- data.frame (\'Variable Name\'=rep (NA, length (objects)), check.names=FALSE)\n');
- echo ('for (i in 1:length (objects)) {\n');
- echo (' var <- eval (objects[[i]], envir=globalenv ())\n');
- echo (' results[i, \'Variable Name\'] <- rk.get.description (objects[[i]], is.substitute=TRUE)\n');
- echo ('\n');
+ echo ('vars <- rk.list (' + vars.split ("\n").join (", ") + ')\n');
+ echo ('results <- data.frame (\'Variable Name\'=I(names (vars)), check.names=FALSE)\n');
+ echo ('for (i in 1:length (vars)) {\n');
+ echo (' var <- vars[[i]]\n');
echo (' try ({\n');
if (getValue ("skewness")) {
echo (' results[i, \'Skewness\'] <- skewness (var' + narm + ')\n');
Modified: trunk/rkward/rkward/plugins/analysis/outliers/chisq_out_test.js
===================================================================
--- trunk/rkward/rkward/plugins/analysis/outliers/chisq_out_test.js 2011-05-27 13:19:37 UTC (rev 3637)
+++ trunk/rkward/rkward/plugins/analysis/outliers/chisq_out_test.js 2011-05-28 12:32:52 UTC (rev 3638)
@@ -3,22 +3,20 @@
}
function calculate () {
- var vars = "substitute (" + trim (getValue ("x")).replace (/\n/g, "), substitute (") + ")";
+ var vars = trim (getValue ("x"));
- echo ('\n');
- echo ('vars <- list (' + vars + ')\n');
- echo ('results <- data.frame (\'Variable Name\'=rep (NA, length (vars)), check.names=FALSE)\n');
- echo ('for (i in 1:length(vars)) {\n');
- echo (' results[i, \'Variable Name\'] <- rk.get.description (vars[[i]], is.substitute=TRUE)\n');
+ echo ('vars <- rk.list (' + vars.split ("\n").join (", ") + ')\n');
+ echo ('results <- data.frame (\'Variable Name\'=I(names (vars)), check.names=FALSE)\n');
+ echo ('for (i in 1:length (vars)) {\n');
if (getValue ("length")) {
- echo (' var <- eval (vars[[i]], envir=globalenv ())\n');
+ echo (' var <- vars[[i]]\n');
echo ('\n');
echo (' results[i, \'Length\'] <- length (var)\n');
echo (' results[i, \'NAs\'] <- sum (is.na(var))\n');
echo ('\n');
echo (' var <- na.omit (var) # omit NAs for all further calculations\n');
} else {
- echo (' var <- na.omit (eval (vars[[i]], envir=globalenv ()))\n');
+ echo (' var <- na.omit (vars[[i]])\n');
}
echo ('\n');
echo (' results[i, \'Error\'] <- tryCatch ({\n');
Modified: trunk/rkward/rkward/plugins/analysis/outliers/dixon_test.js
===================================================================
--- trunk/rkward/rkward/plugins/analysis/outliers/dixon_test.js 2011-05-27 13:19:37 UTC (rev 3637)
+++ trunk/rkward/rkward/plugins/analysis/outliers/dixon_test.js 2011-05-28 12:32:52 UTC (rev 3638)
@@ -3,22 +3,20 @@
}
function calculate () {
- var vars = "substitute (" + trim (getValue ("x")).replace (/\n/g, "), substitute (") + ")";
+ var vars = trim (getValue ("x"));
- echo ('\n');
- echo ('vars <- list (' + vars + ')\n');
- echo ('results <- data.frame (\'Variable Name\'=rep (NA, length (vars)), check.names=FALSE)\n');
- echo ('for (i in 1:length(vars)) {\n');
- echo (' results[i, \'Variable Name\'] <- rk.get.description (vars[[i]], is.substitute=TRUE)\n');
+ echo ('vars <- rk.list (' + vars.split ("\n").join (", ") + ')\n');
+ echo ('results <- data.frame (\'Variable Name\'=I(names (vars)), check.names=FALSE)\n');
+ echo ('for (i in 1:length (vars)) {\n');
if (getValue ("length")) {
- echo (' var <- eval (vars[[i]], envir=globalenv ())\n');
+ echo (' var <- vars[[i]]\n');
echo ('\n');
echo (' results[i, \'Length\'] <- length (var)\n');
echo (' results[i, \'NAs\'] <- sum (is.na(var))\n');
echo ('\n');
echo (' var <- na.omit (var) # omit NAs for all further calculations\n');
} else {
- echo (' var <- na.omit (eval (vars[[i]], envir=globalenv ()))\n');
+ echo (' var <- na.omit (vars[[i]])\n');
}
echo ('\n');
echo (' results[i, \'Error\'] <- tryCatch ({\n');
Modified: trunk/rkward/rkward/plugins/analysis/outliers/grubbs_test.js
===================================================================
--- trunk/rkward/rkward/plugins/analysis/outliers/grubbs_test.js 2011-05-27 13:19:37 UTC (rev 3637)
+++ trunk/rkward/rkward/plugins/analysis/outliers/grubbs_test.js 2011-05-28 12:32:52 UTC (rev 3638)
@@ -3,22 +3,20 @@
}
function calculate () {
- var vars = "substitute (" + trim (getValue ("x")).replace (/\n/g, "), substitute (") + ")";
+ var vars = trim (getValue ("x"));
- echo ('\n');
- echo ('vars <- list (' + vars + ')\n');
- echo ('results <- data.frame (\'Variable Name\'=rep (NA, length (vars)), check.names=FALSE)\n');
- echo ('for (i in 1:length(vars)) {\n');
- echo (' results[i, \'Variable Name\'] <- rk.get.description (vars[[i]], is.substitute=TRUE)\n');
+ echo ('vars <- rk.list (' + vars.split ("\n").join (", ") + ')\n');
+ echo ('results <- data.frame (\'Variable Name\'=I(names (vars)), check.names=FALSE)\n');
+ echo ('for (i in 1:length (vars)) {\n');
if (getValue ("length")) {
- echo (' var <- eval (vars[[i]], envir=globalenv ())\n');
+ echo (' var <- vars[[i]]\n');
echo ('\n');
echo (' results[i, \'Length\'] <- length (var)\n');
echo (' results[i, \'NAs\'] <- sum (is.na(var))\n');
echo ('\n');
echo (' var <- na.omit (var) # omit NAs for all further calculations\n');
} else {
- echo (' var <- na.omit (eval (vars[[i]], envir=globalenv ()))\n');
+ echo (' var <- na.omit (vars[[i]])\n');
}
echo ('\n');
echo (' results[i, \'Error\'] <- tryCatch ({\n');
Modified: trunk/rkward/rkward/plugins/analysis/outliers/outlier.js
===================================================================
--- trunk/rkward/rkward/plugins/analysis/outliers/outlier.js 2011-05-27 13:19:37 UTC (rev 3637)
+++ trunk/rkward/rkward/plugins/analysis/outliers/outlier.js 2011-05-28 12:32:52 UTC (rev 3638)
@@ -3,22 +3,20 @@
}
function calculate () {
- var vars = "substitute (" + trim (getValue ("x")).replace (/\n/g, "), substitute (") + ")";
+ var vars = trim (getValue ("x"));
- echo ('\n');
- echo ('vars <- list (' + vars + ')\n');
- echo ('results <- data.frame (\'Variable Name\'=rep (NA, length (vars)), check.names=FALSE)\n');
- echo ('for (i in 1:length(vars)) {\n');
- echo (' results[i, \'Variable Name\'] <- rk.get.description (vars[[i]], is.substitute=TRUE)\n');
+ echo ('vars <- rk.list (' + vars.split ("\n").join (", ") + ')\n');
+ echo ('results <- data.frame (\'Variable Name\'=I(names (vars)), check.names=FALSE)\n');
+ echo ('for (i in 1:length (vars)) {\n');
if (getValue ("length")) {
- echo (' var <- eval (vars[[i]], envir=globalenv ())\n');
+ echo (' var <- vars[[i]]\n');
echo ('\n');
echo (' results[i, \'Length\'] <- length (var)\n');
echo (' results[i, \'NAs\'] <- sum (is.na(var))\n');
echo ('\n');
echo (' var <- na.omit (var) # omit NAs for all further calculations\n');
} else {
- echo (' var <- na.omit (eval (vars[[i]], envir=globalenv ()))\n');
+ echo (' var <- na.omit (vars[[i]])\n');
}
echo ('\n');
echo (' results[i, \'Error\'] <- tryCatch ({\n');
Modified: trunk/rkward/rkward/plugins/analysis/time_series/Box_test.js
===================================================================
--- trunk/rkward/rkward/plugins/analysis/time_series/Box_test.js 2011-05-27 13:19:37 UTC (rev 3637)
+++ trunk/rkward/rkward/plugins/analysis/time_series/Box_test.js 2011-05-28 12:32:52 UTC (rev 3638)
@@ -1,11 +1,10 @@
function calculate () {
- var vars = "substitute (" + trim (getValue ("x")).replace (/\n/g, "), substitute (") + ")";
+ var vars = trim (getValue ("x"));
- echo ('objects <- list (' + vars + ')\n');
- echo ('results <- data.frame (\'Variable Name\'=rep (NA, length (objects)), check.names=FALSE)\n');
- echo ('for (i in 1:length (objects)) {\n');
- echo (' results[i, \'Variable Name\'] <- rk.get.description (objects[[i]], is.substitute=TRUE)\n');
- echo (' var <- eval (objects[[i]], envir=globalenv ())\n');
+ echo ('vars <- rk.list (' + vars.split ("\n").join (", ") + ')\n');
+ echo ('results <- data.frame (\'Variable Name\'=I(names (vars)), check.names=FALSE)\n');
+ echo ('for (i in 1:length (vars)) {\n');
+ echo (' var <- vars[[i]]\n');
if (getValue ("length")) {
echo (' results[i, \'Length\'] <- length (var)\n');
echo (' results[i, \'NAs\'] <- sum (is.na(var))\n');
Modified: trunk/rkward/rkward/plugins/analysis/time_series/kpss_test.js
===================================================================
--- trunk/rkward/rkward/plugins/analysis/time_series/kpss_test.js 2011-05-27 13:19:37 UTC (rev 3637)
+++ trunk/rkward/rkward/plugins/analysis/time_series/kpss_test.js 2011-05-28 12:32:52 UTC (rev 3638)
@@ -3,13 +3,12 @@
}
function calculate () {
- var vars = "substitute (" + trim (getValue ("x")).replace (/\n/g, "), substitute (") + ")";
+ var vars = trim (getValue ("x"));
- echo ('objects <- list (' + vars + ')\n');
- echo ('results <- data.frame (\'Variable Name\'=rep (NA, length (objects)), check.names=FALSE)\n');
- echo ('for (i in 1:length (objects)) {\n');
- echo (' results[i, \'Variable Name\'] <- rk.get.description (objects[[i]], is.substitute=TRUE)\n');
- echo (' var <- eval (objects[[i]], envir=globalenv ())\n');
+ echo ('vars <- rk.list (' + vars.split ("\n").join (", ") + ')\n');
+ echo ('results <- data.frame (\'Variable Name\'=I(names (vars)), check.names=FALSE)\n');
+ echo ('for (i in 1:length (vars)) {\n');
+ echo (' var <- vars[[i]]\n');
if (getValue ("length")) {
echo (' results[i, \'Length\'] <- length (var)\n');
echo (' results[i, \'NAs\'] <- sum (is.na(var))\n');
Modified: trunk/rkward/rkward/plugins/uni1.2/code.js
===================================================================
--- trunk/rkward/rkward/plugins/uni1.2/code.js 2011-05-27 13:19:37 UTC (rev 3637)
+++ trunk/rkward/rkward/plugins/uni1.2/code.js 2011-05-28 12:32:52 UTC (rev 3638)
@@ -1,16 +1,13 @@
function calculate () {
- var vars = "substitute (" + trim (getValue ("z")).replace (/\n/g, "), substitute (") + ")";
-
var narm = "na.rm=FALSE";
if (getValue ("narm")) narm = "na.rm=TRUE";
- echo ('vars <- list (' + vars + ')\n');
- echo ('results <- data.frame (\'Variable Name\'=rep (NA, length (vars)), check.names=FALSE)\n');
+ var vars = trim (getValue ("z"));
+ echo ('vars <- rk.list (' + vars.split ("\n").join (", ") + ')\n');
+ echo ('results <- data.frame (\'Variable Name\'=I(names (vars)), check.names=FALSE)\n');
+ echo ('for (i in 1:length (vars)) {\n');
+ echo (' var <- vars[[i]]\n');
echo ('\n');
- echo ('for (i in 1:length (vars)) {\n');
- echo (' var <- eval (vars[[i]], envir=globalenv());\n');
- echo (' results[i, \'Variable Name\'] <- rk.get.description(vars[[i]], is.substitute=TRUE)\n');
- echo ('\n');
if (getValue ("length")) {
echo (' results[i, \'Number of obs\'] <- length(var)\n');
echo (' results[i, \'Number of missing values\'] <- sum(is.na(var))\n');
Modified: trunk/rkward/tests/analysis_plugins/RKTestStandard.agostino_test.rkcommands.R
===================================================================
--- trunk/rkward/tests/analysis_plugins/RKTestStandard.agostino_test.rkcommands.R 2011-05-27 13:19:37 UTC (rev 3637)
+++ trunk/rkward/tests/analysis_plugins/RKTestStandard.agostino_test.rkcommands.R 2011-05-28 12:32:52 UTC (rev 3638)
@@ -2,13 +2,10 @@
## Prepare
require(moments)
## Compute
-
-vars <- list (substitute (warpbreaks[["breaks"]]), substitute (test50z), substitute (test10x))
-results <- data.frame ('Variable Name'=rep (NA, length (vars)), check.names=FALSE)
-
-for (i in 1:length(vars)) {
- results[i, 'Variable Name'] <- rk.get.description (vars[[i]], is.substitute=TRUE)
- var <- eval (vars[[i]], envir=globalenv ())
+vars <- rk.list (warpbreaks[["breaks"]], test50z, test10x)
+results <- data.frame ('Variable Name'=I(names (vars)), check.names=FALSE)
+for (i in 1:length (vars)) {
+ var <- vars[[i]]
results[i, 'Error'] <- tryCatch ({
# This is the core of the calculation
t <- agostino.test (var, alternative = "two.sided")
Modified: trunk/rkward/tests/analysis_plugins/RKTestStandard.anscombe_test.rkcommands.R
===================================================================
--- trunk/rkward/tests/analysis_plugins/RKTestStandard.anscombe_test.rkcommands.R 2011-05-27 13:19:37 UTC (rev 3637)
+++ trunk/rkward/tests/analysis_plugins/RKTestStandard.anscombe_test.rkcommands.R 2011-05-28 12:32:52 UTC (rev 3638)
@@ -2,12 +2,10 @@
## Prepare
require(moments)
## Compute
-vars <- list (substitute (warpbreaks[["breaks"]]), substitute (test50z), substitute (test10y))
-results <- data.frame ('Variable Name'=rep (NA, length (vars)), check.names=FALSE)
-
-for (i in 1:length(vars)) {
- results[i, 'Variable Name'] <- rk.get.description (vars[[i]], is.substitute=TRUE)
- var <- eval (vars[[i]], envir=globalenv ())
+vars <- rk.list (warpbreaks[["breaks"]], test50z, test10y)
+results <- data.frame ('Variable Name'=I(names (vars)), check.names=FALSE)
+for (i in 1:length (vars)) {
+ var <- vars[[i]]
results[i, 'Error'] <- tryCatch ({
t <- anscombe.test (var, alternative = "two.sided")
results[i, 'Kurtosis estimator (tau)'] <- t$statistic["kurt"]
Modified: trunk/rkward/tests/analysis_plugins/RKTestStandard.basic_statistics_a.rkcommands.R
===================================================================
--- trunk/rkward/tests/analysis_plugins/RKTestStandard.basic_statistics_a.rkcommands.R 2011-05-27 13:19:37 UTC (rev 3637)
+++ trunk/rkward/tests/analysis_plugins/RKTestStandard.basic_statistics_a.rkcommands.R 2011-05-28 12:32:52 UTC (rev 3638)
@@ -1,13 +1,11 @@
local({
## Prepare
## Compute
-vars <- list (substitute (women[["weight"]]), substitute (test50x))
-results <- data.frame ('Variable Name'=rep (NA, length (vars)), check.names=FALSE)
+vars <- rk.list (women[["weight"]], test50x)
+results <- data.frame ('Variable Name'=I(names (vars)), check.names=FALSE)
+for (i in 1:length (vars)) {
+ var <- vars[[i]]
-for (i in 1:length (vars)) {
- var <- eval (vars[[i]], envir=globalenv());
- results[i, 'Variable Name'] <- rk.get.description(vars[[i]], is.substitute=TRUE)
-
results[i, 'Number of obs'] <- length(var)
results[i, 'Number of missing values'] <- sum(is.na(var))
results[i, 'Mean'] <- mean(var,na.rm=TRUE)
Modified: trunk/rkward/tests/analysis_plugins/RKTestStandard.basic_statistics_b.rkcommands.R
===================================================================
--- trunk/rkward/tests/analysis_plugins/RKTestStandard.basic_statistics_b.rkcommands.R 2011-05-27 13:19:37 UTC (rev 3637)
+++ trunk/rkward/tests/analysis_plugins/RKTestStandard.basic_statistics_b.rkcommands.R 2011-05-28 12:32:52 UTC (rev 3638)
@@ -1,13 +1,11 @@
local({
## Prepare
## Compute
-vars <- list (substitute (test10x), substitute (women[["height"]]))
-results <- data.frame ('Variable Name'=rep (NA, length (vars)), check.names=FALSE)
+vars <- rk.list (test10x, women[["height"]])
+results <- data.frame ('Variable Name'=I(names (vars)), check.names=FALSE)
+for (i in 1:length (vars)) {
+ var <- vars[[i]]
-for (i in 1:length (vars)) {
- var <- eval (vars[[i]], envir=globalenv());
- results[i, 'Variable Name'] <- rk.get.description(vars[[i]], is.substitute=TRUE)
-
if (length (var) >= 2) {
results[i, 'Minimum values'] <- paste (sort(var, decreasing=FALSE, na.last=TRUE)[1:2], collapse=" ")
}
Modified: trunk/rkward/tests/analysis_plugins/RKTestStandard.bonett_test.rkcommands.R
===================================================================
--- trunk/rkward/tests/analysis_plugins/RKTestStandard.bonett_test.rkcommands.R 2011-05-27 13:19:37 UTC (rev 3637)
+++ trunk/rkward/tests/analysis_plugins/RKTestStandard.bonett_test.rkcommands.R 2011-05-28 12:32:52 UTC (rev 3638)
@@ -2,13 +2,10 @@
## Prepare
require(moments)
## Compute
-
-vars <- list (substitute (test50z), substitute (test50y), substitute (test50x), substitute (test10z), substitute (test10y), substitute (test10x))
-results <- data.frame ('Variable Name'=rep (NA, length (vars)), check.names=FALSE)
-
-for (i in 1:length(vars)) {
- results[i, 'Variable Name'] <- rk.get.description (vars[[i]], is.substitute=TRUE)
- var <- eval (vars[[i]], envir=globalenv ())
+vars <- rk.list (test50z, test50y, test50x, test10z, test10y, test10x)
+results <- data.frame ('Variable Name'=I(names (vars)), check.names=FALSE)
+for (i in 1:length (vars)) {
+ var <- vars[[i]]
results[i, 'Error'] <- tryCatch ({
t <- bonett.test (var, alternative = "two.sided")
results[i, 'Kurtosis estimator (tau)'] <- t$statistic["tau"]
Modified: trunk/rkward/tests/analysis_plugins/RKTestStandard.box_test.rkcommands.R
===================================================================
--- trunk/rkward/tests/analysis_plugins/RKTestStandard.box_test.rkcommands.R 2011-05-27 13:19:37 UTC (rev 3637)
+++ trunk/rkward/tests/analysis_plugins/RKTestStandard.box_test.rkcommands.R 2011-05-28 12:32:52 UTC (rev 3638)
@@ -1,11 +1,10 @@
local({
## Prepare
## Compute
-objects <- list (substitute (test50x), substitute (test10y))
-results <- data.frame ('Variable Name'=rep (NA, length (objects)), check.names=FALSE)
-for (i in 1:length (objects)) {
- results[i, 'Variable Name'] <- rk.get.description (objects[[i]], is.substitute=TRUE)
- var <- eval (objects[[i]], envir=globalenv ())
+vars <- rk.list (test50x, test10y)
+results <- data.frame ('Variable Name'=I(names (vars)), check.names=FALSE)
+for (i in 1:length (vars)) {
+ var <- vars[[i]]
results[i, 'Length'] <- length (var)
results[i, 'NAs'] <- sum (is.na(var))
Modified: trunk/rkward/tests/analysis_plugins/RKTestStandard.chisq_out_test.rkcommands.R
===================================================================
--- trunk/rkward/tests/analysis_plugins/RKTestStandard.chisq_out_test.rkcommands.R 2011-05-27 13:19:37 UTC (rev 3637)
+++ trunk/rkward/tests/analysis_plugins/RKTestStandard.chisq_out_test.rkcommands.R 2011-05-28 12:32:52 UTC (rev 3638)
@@ -2,13 +2,11 @@
## Prepare
require(outliers)
## Compute
+vars <- rk.list (rock[["shape"]], rock[["perm"]], rock[["peri"]], rock[["area"]])
+results <- data.frame ('Variable Name'=I(names (vars)), check.names=FALSE)
+for (i in 1:length (vars)) {
+ var <- vars[[i]]
-vars <- list (substitute (rock[["shape"]]), substitute (rock[["perm"]]), substitute (rock[["peri"]]), substitute (rock[["area"]]))
-results <- data.frame ('Variable Name'=rep (NA, length (vars)), check.names=FALSE)
-for (i in 1:length(vars)) {
- results[i, 'Variable Name'] <- rk.get.description (vars[[i]], is.substitute=TRUE)
- var <- eval (vars[[i]], envir=globalenv ())
-
results[i, 'Length'] <- length (var)
results[i, 'NAs'] <- sum (is.na(var))
@@ -41,13 +39,11 @@
## Prepare
require(outliers)
## Compute
+vars <- rk.list (rock[["shape"]], rock[["perm"]], rock[["peri"]], rock[["area"]])
+results <- data.frame ('Variable Name'=I(names (vars)), check.names=FALSE)
+for (i in 1:length (vars)) {
+ var <- na.omit (vars[[i]])
-vars <- list (substitute (rock[["shape"]]), substitute (rock[["perm"]]), substitute (rock[["peri"]]), substitute (rock[["area"]]))
-results <- data.frame ('Variable Name'=rep (NA, length (vars)), check.names=FALSE)
-for (i in 1:length(vars)) {
- results[i, 'Variable Name'] <- rk.get.description (vars[[i]], is.substitute=TRUE)
- var <- na.omit (eval (vars[[i]], envir=globalenv ()))
-
results[i, 'Error'] <- tryCatch ({
# This is the core of the calculation
t <- chisq.out.test (var, opposite = TRUE)
Modified: trunk/rkward/tests/analysis_plugins/RKTestStandard.correlation_matrix.rkcommands.R
===================================================================
--- trunk/rkward/tests/analysis_plugins/RKTestStandard.correlation_matrix.rkcommands.R 2011-05-27 13:19:37 UTC (rev 3637)
+++ trunk/rkward/tests/analysis_plugins/RKTestStandard.correlation_matrix.rkcommands.R 2011-05-28 12:32:52 UTC (rev 3638)
@@ -1,16 +1,14 @@
local({
## Prepare
## Compute
-objects <- list (substitute (test50x), substitute (test50y), substitute (test50z))
-
# cor requires all objects to be inside the same data.frame.
# Here we construct such a temporary frame from the input variables
-data <- data.frame (lapply (objects, function (x) eval (x, envir=globalenv ())))
+data <- as.data.frame (rk.list (test50x, test50y, test50z), check.names=FALSE)
# calculate correlation matrix
result <- cor (data, use="pairwise.complete.obs", method="pearson")
# calculate matrix of probabilities
-result.p <- matrix (nrow = length (data), ncol = length (data))
+result.p <- matrix (nrow = length (data), ncol = length (data), dimnames=list (names (data), names (data)))
for (i in 1:length (data)) {
for (j in i:length (data)) {
if (i != j) {
@@ -23,31 +21,24 @@
## Print result
rk.header ("Correlation Matrix", parameters=list ("Method", "pearson", "Exclusion", "pairwise.complete.obs"))
-result <- data.frame (I (sapply (objects, FUN=function (x) rk.get.description (x, is.substitute=TRUE))), as.data.frame (result))
-rk.results (result, titles=c ('Coefficient', sapply (objects, rk.get.short.name)))
-
-result.p <- data.frame (I (sapply (objects, FUN=function (x) rk.get.description (x, is.substitute=TRUE))), as.data.frame (result.p))
-rk.results (result.p, titles=c ('n \\ p', sapply (objects, rk.get.short.name)))
+rk.results (data.frame ("Coefficient"=I(names (data)), result, check.names=FALSE))
+rk.results (data.frame ("n \\ p"=I(names (data)), result.p, check.names=FALSE))
})
.rk.rerun.plugin.link(plugin="rkward::corr_matrix", settings="do_p.state=1\nmethod.string=pearson\nuse.string=pairwise\nx.available=test50x\\ntest50y\\ntest50z", label="Run again")
.rk.make.hr()
local({
## Prepare
## Compute
-objects <- list (substitute (women[["weight"]]), substitute (women[["height"]]))
-
# cor requires all objects to be inside the same data.frame.
# Here we construct such a temporary frame from the input variables
-data <- data.frame (lapply (objects, function (x) eval (x, envir=globalenv ())))
+data <- as.data.frame (rk.list (women[["weight"]], women[["height"]]), check.names=FALSE)
# calculate correlation matrix
result <- cor (data, use="pairwise.complete.obs", method="pearson")
## Print result
rk.header ("Correlation Matrix", parameters=list ("Method", "pearson", "Exclusion", "pairwise.complete.obs"))
-result <- data.frame (I (sapply (objects, FUN=function (x) rk.get.description (x, is.substitute=TRUE))), as.data.frame (result))
-rk.results (result, titles=c ('Coefficient', sapply (objects, rk.get.short.name)))
-
+rk.results (data.frame ("Coefficient"=I(names (data)), result, check.names=FALSE))
})
.rk.rerun.plugin.link(plugin="rkward::corr_matrix", settings="do_p.state=\nmethod.string=pearson\nuse.string=pairwise\nx.available=women[[\\\"weight\\\"]]\\nwomen[[\\\"height\\\"]]", label="Run again")
.rk.make.hr()
Modified: trunk/rkward/tests/analysis_plugins/RKTestStandard.dixon_test.rkcommands.R
===================================================================
--- trunk/rkward/tests/analysis_plugins/RKTestStandard.dixon_test.rkcommands.R 2011-05-27 13:19:37 UTC (rev 3637)
+++ trunk/rkward/tests/analysis_plugins/RKTestStandard.dixon_test.rkcommands.R 2011-05-28 12:32:52 UTC (rev 3638)
@@ -2,13 +2,11 @@
## Prepare
require(outliers)
## Compute
+vars <- rk.list (women[["weight"]], women[["height"]])
+results <- data.frame ('Variable Name'=I(names (vars)), check.names=FALSE)
+for (i in 1:length (vars)) {
+ var <- vars[[i]]
-vars <- list (substitute (women[["weight"]]), substitute (women[["height"]]))
-results <- data.frame ('Variable Name'=rep (NA, length (vars)), check.names=FALSE)
-for (i in 1:length(vars)) {
- results[i, 'Variable Name'] <- rk.get.description (vars[[i]], is.substitute=TRUE)
- var <- eval (vars[[i]], envir=globalenv ())
-
results[i, 'Length'] <- length (var)
results[i, 'NAs'] <- sum (is.na(var))
@@ -40,13 +38,11 @@
## Prepare
require(outliers)
## Compute
+vars <- rk.list (women[["weight"]], women[["height"]])
+results <- data.frame ('Variable Name'=I(names (vars)), check.names=FALSE)
+for (i in 1:length (vars)) {
+ var <- na.omit (vars[[i]])
-vars <- list (substitute (women[["weight"]]), substitute (women[["height"]]))
-results <- data.frame ('Variable Name'=rep (NA, length (vars)), check.names=FALSE)
-for (i in 1:length(vars)) {
- results[i, 'Variable Name'] <- rk.get.description (vars[[i]], is.substitute=TRUE)
- var <- na.omit (eval (vars[[i]], envir=globalenv ()))
-
results[i, 'Error'] <- tryCatch ({
# This is the core of the calculation
t <- dixon.test (var, type = 0, opposite = TRUE, two.sided = FALSE)
Modified: trunk/rkward/tests/analysis_plugins/RKTestStandard.grubbs_test.rkcommands.R
===================================================================
--- trunk/rkward/tests/analysis_plugins/RKTestStandard.grubbs_test.rkcommands.R 2011-05-27 13:19:37 UTC (rev 3637)
+++ trunk/rkward/tests/analysis_plugins/RKTestStandard.grubbs_test.rkcommands.R 2011-05-28 12:32:52 UTC (rev 3638)
@@ -2,13 +2,11 @@
## Prepare
require(outliers)
## Compute
+vars <- rk.list (warpbreaks[["breaks"]], test10z)
+results <- data.frame ('Variable Name'=I(names (vars)), check.names=FALSE)
+for (i in 1:length (vars)) {
+ var <- vars[[i]]
-vars <- list (substitute (warpbreaks[["breaks"]]), substitute (test10z))
-results <- data.frame ('Variable Name'=rep (NA, length (vars)), check.names=FALSE)
-for (i in 1:length(vars)) {
- results[i, 'Variable Name'] <- rk.get.description (vars[[i]], is.substitute=TRUE)
- var <- eval (vars[[i]], envir=globalenv ())
-
results[i, 'Length'] <- length (var)
results[i, 'NAs'] <- sum (is.na(var))
@@ -36,13 +34,11 @@
## Prepare
require(outliers)
## Compute
+vars <- rk.list (warpbreaks[["breaks"]], test10z)
+results <- data.frame ('Variable Name'=I(names (vars)), check.names=FALSE)
+for (i in 1:length (vars)) {
+ var <- vars[[i]]
-vars <- list (substitute (warpbreaks[["breaks"]]), substitute (test10z))
-results <- data.frame ('Variable Name'=rep (NA, length (vars)), check.names=FALSE)
-for (i in 1:length(vars)) {
- results[i, 'Variable Name'] <- rk.get.description (vars[[i]], is.substitute=TRUE)
- var <- eval (vars[[i]], envir=globalenv ())
-
results[i, 'Length'] <- length (var)
results[i, 'NAs'] <- sum (is.na(var))
Modified: trunk/rkward/tests/analysis_plugins/RKTestStandard.kpss_test.rkcommands.R
===================================================================
--- trunk/rkward/tests/analysis_plugins/RKTestStandard.kpss_test.rkcommands.R 2011-05-27 13:19:37 UTC (rev 3637)
+++ trunk/rkward/tests/analysis_plugins/RKTestStandard.kpss_test.rkcommands.R 2011-05-28 12:32:52 UTC (rev 3638)
@@ -2,11 +2,10 @@
## Prepare
require (tseries)
## Compute
-objects <- list (substitute (test50x), substitute (test50y), substitute (test50z))
-results <- data.frame ('Variable Name'=rep (NA, length (objects)), check.names=FALSE)
-for (i in 1:length (objects)) {
- results[i, 'Variable Name'] <- rk.get.description (objects[[i]], is.substitute=TRUE)
- var <- eval (objects[[i]], envir=globalenv ())
+vars <- rk.list (test50x, test50y, test50z)
+results <- data.frame ('Variable Name'=I(names (vars)), check.names=FALSE)
+for (i in 1:length (vars)) {
+ var <- vars[[i]]
results[i, 'Length'] <- length (var)
results[i, 'NAs'] <- sum (is.na(var))
Modified: trunk/rkward/tests/analysis_plugins/RKTestStandard.moments_moment.rkcommands.R
===================================================================
--- trunk/rkward/tests/analysis_plugins/RKTestStandard.moments_moment.rkcommands.R 2011-05-27 13:19:37 UTC (rev 3637)
+++ trunk/rkward/tests/analysis_plugins/RKTestStandard.moments_moment.rkcommands.R 2011-05-28 12:32:52 UTC (rev 3638)
@@ -2,13 +2,10 @@
## Prepare
require(moments)
## Compute
-
-objects <- list (substitute (test50z), substitute (test50y), substitute (test50x), substitute (test10z), substitute (test10y), substitute (test10x))
-results <- data.frame ('Variable Name'=rep (NA, length (objects)), check.names=FALSE)
-for (i in 1:length (objects)) {
- var <- eval (objects[[i]], envir=globalenv ())
- results[i, 'Variable Name'] <- rk.get.description (objects[[i]], is.substitute=TRUE)
-
+vars <- rk.list (test50z, test50y, test50x, test10z, test10y, test10x)
+results <- data.frame ('Variable Name'=I(names (vars)), check.names=FALSE)
+for (i in 1:length (vars)) {
+ var <- vars[[i]]
try (results[i, 'Moment'] <- moment (var, order = 1, central = FALSE, absolute = FALSE, na.rm = TRUE))
}
## Print result
Modified: trunk/rkward/tests/analysis_plugins/RKTestStandard.outlier.rkcommands.R
===================================================================
--- trunk/rkward/tests/analysis_plugins/RKTestStandard.outlier.rkcommands.R 2011-05-27 13:19:37 UTC (rev 3637)
+++ trunk/rkward/tests/analysis_plugins/RKTestStandard.outlier.rkcommands.R 2011-05-28 12:32:52 UTC (rev 3638)
@@ -2,13 +2,11 @@
## Prepare
require(outliers)
## Compute
+vars <- rk.list (warpbreaks[["breaks"]], test50z)
+results <- data.frame ('Variable Name'=I(names (vars)), check.names=FALSE)
+for (i in 1:length (vars)) {
+ var <- vars[[i]]
-vars <- list (substitute (warpbreaks[["breaks"]]), substitute (test50z))
-results <- data.frame ('Variable Name'=rep (NA, length (vars)), check.names=FALSE)
-for (i in 1:length(vars)) {
- results[i, 'Variable Name'] <- rk.get.description (vars[[i]], is.substitute=TRUE)
- var <- eval (vars[[i]], envir=globalenv ())
-
results[i, 'Length'] <- length (var)
results[i, 'NAs'] <- sum (is.na(var))
@@ -33,13 +31,11 @@
## Prepare
require(outliers)
## Compute
+vars <- rk.list (warpbreaks[["breaks"]], test50z)
+results <- data.frame ('Variable Name'=I(names (vars)), check.names=FALSE)
+for (i in 1:length (vars)) {
+ var <- na.omit (vars[[i]])
-vars <- list (substitute (warpbreaks[["breaks"]]), substitute (test50z))
-results <- data.frame ('Variable Name'=rep (NA, length (vars)), check.names=FALSE)
-for (i in 1:length(vars)) {
- results[i, 'Variable Name'] <- rk.get.description (vars[[i]], is.substitute=TRUE)
- var <- na.omit (eval (vars[[i]], envir=globalenv ()))
-
results[i, 'Error'] <- tryCatch ({
# This is the core of the calculation
t <- outlier (var, opposite = TRUE)
Modified: trunk/rkward/tests/analysis_plugins/RKTestStandard.pp_test.rkcommands.R
===================================================================
--- trunk/rkward/tests/analysis_plugins/RKTestStandard.pp_test.rkcommands.R 2011-05-27 13:19:37 UTC (rev 3637)
+++ trunk/rkward/tests/analysis_plugins/RKTestStandard.pp_test.rkcommands.R 2011-05-28 12:32:52 UTC (rev 3638)
@@ -1,11 +1,10 @@
local({
## Prepare
## Compute
-objects <- list (substitute (rock[["shape"]]), substitute (rock[["perm"]]), substitute (rock[["peri"]]), substitute (rock[["area"]]))
-results <- data.frame ('Variable Name'=rep (NA, length (objects)), check.names=FALSE)
-for (i in 1:length (objects)) {
- results[i, 'Variable Name'] <- rk.get.description (objects[[i]], is.substitute=TRUE)
- var <- eval (objects[[i]], envir=globalenv ())
+vars <- rk.list (rock[["shape"]], rock[["perm"]], rock[["peri"]], rock[["area"]])
+results <- data.frame ('Variable Name'=I(names (vars)), check.names=FALSE)
+for (i in 1:length (vars)) {
+ var <- vars[[i]]
results[i, 'Length'] <- length (var)
results[i, 'NAs'] <- sum (is.na(var))
Modified: trunk/rkward/tests/analysis_plugins/RKTestStandard.skewness_kurtosis.rkcommands.R
===================================================================
--- trunk/rkward/tests/analysis_plugins/RKTestStandard.skewness_kurtosis.rkcommands.R 2011-05-27 13:19:37 UTC (rev 3637)
+++ trunk/rkward/tests/analysis_plugins/RKTestStandard.skewness_kurtosis.rkcommands.R 2011-05-28 12:32:52 UTC (rev 3638)
@@ -2,12 +2,10 @@
## Prepare
require(moments)
## Compute
-objects <- list (substitute (women[["weight"]]), substitute (women[["height"]]), substitute (warpbreaks[["breaks"]]))
-results <- data.frame ('Variable Name'=rep (NA, length (objects)), check.names=FALSE)
-for (i in 1:length (objects)) {
- var <- eval (objects[[i]], envir=globalenv ())
- results[i, 'Variable Name'] <- rk.get.description (objects[[i]], is.substitute=TRUE)
-
+vars <- rk.list (women[["weight"]], women[["height"]], warpbreaks[["breaks"]])
+results <- data.frame ('Variable Name'=I(names (vars)), check.names=FALSE)
+for (i in 1:length (vars)) {
+ var <- vars[[i]]
try ({
results[i, 'Skewness'] <- skewness (var, na.rm=TRUE)
results[i, 'Kurtosis'] <- kurtosis (var, na.rm=TRUE)
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