[rkward-cvs] SF.net SVN: rkward: [1649] trunk/rkward/rkward/plugins/analysis/moments

sjar at users.sourceforge.net sjar at users.sourceforge.net
Mon Mar 19 22:57:13 UTC 2007


Revision: 1649
          http://svn.sourceforge.net/rkward/?rev=1649&view=rev
Author:   sjar
Date:     2007-03-19 15:57:13 -0700 (Mon, 19 Mar 2007)

Log Message:
-----------
now! evaluate each substitute only once, and explicitely in globalenv() 

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/analysis/moments/agostino_test.php
    trunk/rkward/rkward/plugins/analysis/moments/anscombe_test.php
    trunk/rkward/rkward/plugins/analysis/moments/bonett_test.php

Modified: trunk/rkward/rkward/plugins/analysis/moments/agostino_test.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/moments/agostino_test.php	2007-03-19 22:51:39 UTC (rev 1648)
+++ trunk/rkward/rkward/plugins/analysis/moments/agostino_test.php	2007-03-19 22:57:13 UTC (rev 1649)
@@ -8,12 +8,12 @@
 	$vars = "substitute (" . str_replace ("\n", "), substitute (", trim (getRK_val ("x"))) . ")";
 ?>
 
-objects <- list (<? echo ($vars); ?>)
-results <- data.frame ('Variable Name'=rep (NA, length (objects)), check.names=FALSE)
+vars <- list (<? echo ($vars); ?>)
+results <- data.frame ('Variable Name'=rep (NA, length (vars)), 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]])
+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, 'Error'] <- tryCatch ({
 		# This is the core of the calculation
 		t <- agostino.test (var, alternative = "<? getRK ("alternative"); ?>")

Modified: trunk/rkward/rkward/plugins/analysis/moments/anscombe_test.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/moments/anscombe_test.php	2007-03-19 22:51:39 UTC (rev 1648)
+++ trunk/rkward/rkward/plugins/analysis/moments/anscombe_test.php	2007-03-19 22:57:13 UTC (rev 1649)
@@ -8,12 +8,12 @@
 	$vars = "substitute (" . str_replace ("\n", "), substitute (", trim (getRK_val ("x"))) . ")";
 
 ?>
-objects <- list (<? echo ($vars); ?>)
-results <- data.frame ('Variable Name'=rep (NA, length (objects)), check.names=FALSE)
+vars <- list (<? echo ($vars); ?>)
+results <- data.frame ('Variable Name'=rep (NA, length (vars)), 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]])
+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, 'Error'] <- tryCatch ({
 		t <- anscombe.test (var, alternative = "<? getRK ("alternative"); ?>")
 		results[i, 'Kurtosis estimator (tau)'] <- t$statistic["kurt"]

Modified: trunk/rkward/rkward/plugins/analysis/moments/bonett_test.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/moments/bonett_test.php	2007-03-19 22:51:39 UTC (rev 1648)
+++ trunk/rkward/rkward/plugins/analysis/moments/bonett_test.php	2007-03-19 22:57:13 UTC (rev 1649)
@@ -9,12 +9,12 @@
 
 ?>
 
-objects <- list (<? echo ($vars); ?>)
-results <- data.frame ('Variable Name'=rep (NA, length (objects)), check.names=FALSE)
+vars <- list (<? echo ($vars); ?>)
+results <- data.frame ('Variable Name'=rep (NA, length (vars)), 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]])
+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, 'Error'] <- tryCatch ({
 		t <- bonett.test (var, alternative = "<? getRK ("alternative"); ?>")
 		results[i, 'Kurtosis estimator (tau)'] <- t$statistic["tau"]


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