[rkward-cvs] SF.net SVN: rkward: [1525] trunk/rkward/rkward/plugins/distributions

sjar at users.sourceforge.net sjar at users.sourceforge.net
Fri Mar 2 00:19:21 UTC 2007


Revision: 1525
          http://svn.sourceforge.net/rkward/?rev=1525&view=rev
Author:   sjar
Date:     2007-03-01 16:19:21 -0800 (Thu, 01 Mar 2007)

Log Message:
-----------
* fixes by using local({ })
* rm (list=grep ("^rk.temp", ls (), value=TRUE))
* minor stuff

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/distributions/ad_test.php
    trunk/rkward/rkward/plugins/distributions/cvm_test.php
    trunk/rkward/rkward/plugins/distributions/lillie_test.php
    trunk/rkward/rkward/plugins/distributions/pearson_test.php
    trunk/rkward/rkward/plugins/distributions/sf_test.php
    trunk/rkward/rkward/plugins/distributions/shapiro_test.php

Modified: trunk/rkward/rkward/plugins/distributions/ad_test.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/ad_test.php	2007-03-01 23:47:01 UTC (rev 1524)
+++ trunk/rkward/rkward/plugins/distributions/ad_test.php	2007-03-02 00:19:21 UTC (rev 1525)
@@ -10,24 +10,24 @@
 
 rk.temp.vars <- list (<? echo ($vars); ?>)
 rk.temp.results <- data.frame ('Variable Name'=rep (NA, length (rk.temp.vars)), check.names=FALSE)
-
+local({
 i=0;
 for (rk.temp.var in rk.temp.vars) {
 	i = i+1
-	rk.temp.results$'Variable Name'[i] <- rk.get.description (rk.temp.var, is.substitute=TRUE)
+	rk.temp.results$'Variable Name'[i] <<- rk.get.description (rk.temp.var, is.substitute=TRUE)
 	<? if (getRK_val ("length")) { ?>
-	try (rk.temp.results$'Length'[i] <- length (eval (rk.temp.var)))
+	try (rk.temp.results$'Length'[i] <<- length (eval (rk.temp.var)))
 	<? }
 	if (getRK_val ("nacount")) { ?>
-	try (rk.temp.results$'NAs'[i] <- length (which(is.na(eval (rk.temp.var)))))
+	try (rk.temp.results$'NAs'[i] <<- length (which(is.na(eval (rk.temp.var)))))
 	<? } ?>
 	try ({
 		rk.temp.test <- ad.test (eval (rk.temp.var))
-		rk.temp.results$'Statistic'[i] <- paste (names (rk.temp.test$statistic), rk.temp.test$statistic, sep=" = ")
-		rk.temp.results$'p-value'[i] <- rk.temp.test$p.value
+		rk.temp.results$'Statistic'[i] <<- paste (names (rk.temp.test$statistic), rk.temp.test$statistic, sep=" = ")
+		rk.temp.results$'p-value'[i] <<- rk.temp.test$p.value
 	})
 }
-
+})
 <?
 }
 
@@ -42,9 +42,7 @@
 function cleanup () {
 
 ?>
-rm (rk.temp.results)
-rm (rk.temp.var)
-rm (rk.temp.test)
+rm (list=grep ("^rk.temp", ls (), value=TRUE))
 <?
 }
 ?>
\ No newline at end of file

Modified: trunk/rkward/rkward/plugins/distributions/cvm_test.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/cvm_test.php	2007-03-01 23:47:01 UTC (rev 1524)
+++ trunk/rkward/rkward/plugins/distributions/cvm_test.php	2007-03-02 00:19:21 UTC (rev 1525)
@@ -10,22 +10,24 @@
 
 rk.temp.vars <- list (<? echo ($vars); ?>)
 rk.temp.results <- data.frame ('Variable Name'=rep (NA, length (rk.temp.vars)), check.names=FALSE)
+local({
 i=0;
 for (var in rk.temp.vars) {
 	i = i+1
-	rk.temp.results$'Variable Name'[i] <- rk.get.description (var, is.substitute=TRUE)
+	rk.temp.results$'Variable Name'[i] <<- rk.get.description (var, is.substitute=TRUE)
 	<? if (getRK_val ("length")) { ?>
-	rk.temp.results$'Length'[i] <- try (length (eval (var)))
+	rk.temp.results$'Length'[i] <<- try (length (eval (var)))
 	<? }
 	if (getRK_val ("nacount")) { ?>
 	rk.temp.results$'NAs'[i] <- try (length (which(is.na(eval (var)))))
 	<? } ?>
 	try ({
 		rk.temp.test <- cvm.test (eval (var))
-		rk.temp.results$'Statistic'[i] <- paste (names (rk.temp.test$statistic), rk.temp.test$statistic, sep=" = ")
-		rk.temp.results$'p-value'[i] <- rk.temp.test$p.value
+		rk.temp.results$'Statistic'[i] <<- paste (names (rk.temp.test$statistic), rk.temp.test$statistic, sep=" = ")
+		rk.temp.results$'p-value'[i] <<- rk.temp.test$p.value
 	})
 }
+})
 <?
         }
 	function printout () {
@@ -37,10 +39,7 @@
 	function cleanup () {
 
 ?>
-rm (rk.temp.results)
-rm (rk.temp.vars)
-rm (rk.temp.test)
-rm (var)
+rm (list=grep ("^rk.temp", ls (), value=TRUE))
 <?
         }
 ?>
\ No newline at end of file

Modified: trunk/rkward/rkward/plugins/distributions/lillie_test.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/lillie_test.php	2007-03-01 23:47:01 UTC (rev 1524)
+++ trunk/rkward/rkward/plugins/distributions/lillie_test.php	2007-03-02 00:19:21 UTC (rev 1525)
@@ -10,22 +10,24 @@
 
 rk.temp.vars <- list (<? echo ($vars); ?>)
 rk.temp.results <- data.frame ('Variable Name'=rep (NA, length (rk.temp.vars)), check.names=FALSE)
+local({
 i=0;
 for (var in rk.temp.vars) {
 	i = i+1
-	rk.temp.results$'Variable Name'[i] <- rk.get.description (var, is.substitute=TRUE)
+	rk.temp.results$'Variable Name'[i] <<- rk.get.description (var, is.substitute=TRUE)
 	<? if (getRK_val ("length")) { ?>
-	rk.temp.results$'Length'[i] <- try (length (eval (var)))
+	rk.temp.results$'Length'[i] <<- try (length (eval (var)))
 	<? }
 	if (getRK_val ("nacount")) { ?>
-	rk.temp.results$'NAs'[i] <- try (length (which(is.na(eval (var)))))
+	rk.temp.results$'NAs'[i] <<- try (length (which(is.na(eval (var)))))
 	<? } ?>
 	try ({
-		rk.temp.test <- lillie.test (eval (var))
-		rk.temp.results$'Statistic'[i] <- paste (names (rk.temp.test$statistic), rk.temp.test$statistic, sep=" = ")
-		rk.temp.results$'p-value'[i] <- rk.temp.test$p.value
+		rk.temp.test <<- lillie.test (eval (var))
+		rk.temp.results$'Statistic'[i] <<- paste (names (rk.temp.test$statistic), rk.temp.test$statistic, sep=" = ")
+		rk.temp.results$'p-value'[i] <<- rk.temp.test$p.value
 	})
 }
+})
 <?
         }
 	function printout () {
@@ -37,10 +39,7 @@
 	function cleanup () {
 
 ?>
-rm (rk.temp.results)
-rm (rk.temp.vars)
-rm (rk.temp.test)
-rm (var)
+rm (list=grep ("^rk.temp", ls (), value=TRUE))
 <?
         }
 ?>
\ No newline at end of file

Modified: trunk/rkward/rkward/plugins/distributions/pearson_test.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/pearson_test.php	2007-03-01 23:47:01 UTC (rev 1524)
+++ trunk/rkward/rkward/plugins/distributions/pearson_test.php	2007-03-02 00:19:21 UTC (rev 1525)
@@ -11,39 +11,39 @@
 
 rk.temp.vars <- list (<? echo ($vars); ?>)
 rk.temp.results <- data.frame ('Variable Name'=rep (NA, length (rk.temp.vars)), check.names=FALSE)
+local({
 i=0;
 for (var in rk.temp.vars) {
 	i = i+1
 	rk.temp.results$'Variable Name'[i] <- rk.get.description (var, is.substitute=TRUE)
 	<? if (getRK_val ("length")) { ?>
-	rk.temp.results$'Length'[i] <- try (length (eval (var)))
+	rk.temp.results$'Length'[i] <<- try (length (eval (var)))
 	<? }
 	if (getRK_val ("nacount")) { ?>
-	rk.temp.results$'NAs'[i] <- try (length (which(is.na(eval (var)))))
+	rk.temp.results$'NAs'[i] <<- try (length (which(is.na(eval (var)))))
 	<? } ?>
 	try ({
 		rk.temp.test <- pearson.test (eval (var), <? echo $adjust; ?>)
-		rk.temp.results$'Statistic'[i] <- paste (names (rk.temp.test$statistic), rk.temp.test$statistic, sep=" = ")
-		rk.temp.results$'p-value'[i] <- rk.temp.test$p.value
-		rk.temp.results$'number of classes'[i] <- rk.temp.test$n.classes
-		rk.temp.results$'degrees of freedom'[i] <- rk.temp.test$df
+		rk.temp.results$'Statistic'[i] <<- paste (names (rk.temp.test$statistic), rk.temp.test$statistic, sep=" = ")
+		rk.temp.results$'p-value'[i] <<- rk.temp.test$p.value
+		rk.temp.results$'number of classes'[i] <<- rk.temp.test$n.classes
+		rk.temp.results$'degrees of freedom'[i] <<- rk.temp.test$df
 	})
 }
+})
 <?
         }
 	function printout () {
 ?>
-rk.header ("Pearson chi-square Normality Test")
+rk.header ("Pearson chi-square Normality Test",
+	parameters=list ("chi-square distribution with n.classes-3 df (TRUE) or chi-square distribution with n.classes-1 df (FALSE)", "<? getRK ("adjust"); ?>"))
 rk.results (rk.temp.results)
 <?
         }
 	function cleanup () {
 
 ?>
-rm (rk.temp.results)
-rm (rk.temp.vars)
-rm (rk.temp.test)
-rm (var)
+rm (list=grep ("^rk.temp", ls (), value=TRUE))
 <?
         }
 ?>
\ No newline at end of file

Modified: trunk/rkward/rkward/plugins/distributions/sf_test.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/sf_test.php	2007-03-01 23:47:01 UTC (rev 1524)
+++ trunk/rkward/rkward/plugins/distributions/sf_test.php	2007-03-02 00:19:21 UTC (rev 1525)
@@ -10,22 +10,24 @@
 
 rk.temp.vars <- list (<? echo ($vars); ?>)
 rk.temp.results <- data.frame ('Variable Name'=rep (NA, length (rk.temp.vars)), check.names=FALSE)
+local({
 i=0;
 for (var in rk.temp.vars) {
 	i = i+1
-	rk.temp.results$'Variable Name'[i] <- rk.get.description (var, is.substitute=TRUE)
+	rk.temp.results$'Variable Name'[i] <<- rk.get.description (var, is.substitute=TRUE)
 	<? if (getRK_val ("length")) { ?>
-	rk.temp.results$'Length'[i] <- try (length (eval (var)))
+	rk.temp.results$'Length'[i] <<- try (length (eval (var)))
 	<? }
 	if (getRK_val ("nacount")) { ?>
-	rk.temp.results$'NAs'[i] <- try (length (which(is.na(eval (var)))))
+	rk.temp.results$'NAs'[i] <<- try (length (which(is.na(eval (var)))))
 	<? } ?>
 	try ({
 		rk.temp.test <- sf.test (eval (var))
-		rk.temp.results$'Statistic'[i] <- paste (names (rk.temp.test$statistic), rk.temp.test$statistic, sep=" = ")
-		rk.temp.results$'p-value'[i] <- rk.temp.test$p.value
+		rk.temp.results$'Statistic'[i] <<- paste (names (rk.temp.test$statistic), rk.temp.test$statistic, sep=" = ")
+		rk.temp.results$'p-value'[i] <<- rk.temp.test$p.value
 	})
 }
+})
 <?
         }
 	function printout () {
@@ -37,10 +39,7 @@
 	function cleanup () {
 
 ?>
-rm (rk.temp.results)
-rm (rk.temp.vars)
-rm (rk.temp.test)
-rm (var)
+rm (list=grep ("^rk.temp", ls (), value=TRUE))
 <?
         }
 ?>
\ No newline at end of file

Modified: trunk/rkward/rkward/plugins/distributions/shapiro_test.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/shapiro_test.php	2007-03-01 23:47:01 UTC (rev 1524)
+++ trunk/rkward/rkward/plugins/distributions/shapiro_test.php	2007-03-02 00:19:21 UTC (rev 1525)
@@ -9,22 +9,24 @@
 
 rk.temp.vars <- list (<? echo ($vars); ?>)
 rk.temp.results <- data.frame ('Variable Name'=rep (NA, length (rk.temp.vars)), check.names=FALSE)
+local({
 i=0;
 for (var in rk.temp.vars) {
 	i = i+1
-	rk.temp.results$'Variable Name'[i] <- rk.get.description (var, is.substitute=TRUE)
+	rk.temp.results$'Variable Name'[i] <<- rk.get.description (var, is.substitute=TRUE)
 	<? if (getRK_val ("length")) { ?>
-	rk.temp.results$'Length'[i] <- try (length (eval (var)))
+	rk.temp.results$'Length'[i] <<- try (length (eval (var)))
 	<? }
 	if (getRK_val ("nacount")) { ?>
-	rk.temp.results$'NAs'[i] <- try (length (which(is.na(eval (var)))))
+	rk.temp.results$'NAs'[i] <<- try (length (which(is.na(eval (var)))))
 	<? } ?>
 	try ({
 		rk.temp.test <- shapiro.test (eval (var))
-		rk.temp.results$'Statistic'[i] <- paste (names (rk.temp.test$statistic), rk.temp.test$statistic, sep=" = ")
-		rk.temp.results$'p-value'[i] <- rk.temp.test$p.value
+		rk.temp.results$'Statistic'[i] <<- paste (names (rk.temp.test$statistic), rk.temp.test$statistic, sep=" = ")
+		rk.temp.results$'p-value'[i] <<- rk.temp.test$p.value
 	})
 }
+})
 <?
         }
 	function printout () {
@@ -36,10 +38,7 @@
 	function cleanup () {
 
 ?>
-rm (rk.temp.results)
-rm (rk.temp.vars)
-rm (rk.temp.test)
-rm (var)
+rm (list=grep ("^rk.temp", ls (), value=TRUE))
 <?
         }
 ?>
\ No newline at end of file


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