[rkward-cvs] SF.net SVN: rkward: [1346] trunk/rkward/rkward/plugins/analysis/corr_matrix .php

tfry at users.sourceforge.net tfry at users.sourceforge.net
Wed Feb 7 12:54:36 UTC 2007


Revision: 1346
          http://svn.sourceforge.net/rkward/?rev=1346&view=rev
Author:   tfry
Date:     2007-02-07 04:54:36 -0800 (Wed, 07 Feb 2007)

Log Message:
-----------
consistency

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/analysis/corr_matrix.php

Modified: trunk/rkward/rkward/plugins/analysis/corr_matrix.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/corr_matrix.php	2007-02-07 12:23:46 UTC (rev 1345)
+++ trunk/rkward/rkward/plugins/analysis/corr_matrix.php	2007-02-07 12:54:36 UTC (rev 1346)
@@ -4,7 +4,11 @@
 	
 function calculate () {
 	global $use;
+	global $method;
+	global $do_p;
 
+	$do_p = getRK_val ("do_p");
+
 	$vars = "substitute (" . str_replace ("\n", "), substitute (", trim (getRK_val ("x"))) . ")";
 	$use = getRK_val ("use");
 	if ($use == "pairwise") {
@@ -14,6 +18,7 @@
 		$exclude_whole = true;
 		$use = "\"complete.obs\"";
 	}
+	$method = "\"" . getRK_val ("method") . "\"";
 
 ?>rk.temp.objects <- list (<? echo ($vars); ?>)
 
@@ -22,8 +27,8 @@
 rk.temp.frame <- data.frame (lapply (rk.temp.objects, function (x) eval (x, envir=globalenv ())))
 
 # calculate correlation matrix
-rk.temp <- cor (rk.temp.frame, use=<? echo ($use); ?>, method="<? getRK ("method"); ?>")
-<?	if (getRK_val ("do_p")) { ?>
+rk.temp <- cor (rk.temp.frame, use=<? echo ($use); ?>, method=<? echo ($method); ?>)
+<?	if ($do_p) { ?>
 # calculate matrix of probabilities
 rk.temp.p <- matrix (nrow = length (rk.temp.frame), ncol = length (rk.temp.frame))
 local ({
@@ -35,7 +40,7 @@
 	for (i in 1:length (rk.temp.frame)) {
 		for (j in i:length (rk.temp.frame)) {
 			if (i != j) {
-				t <- cor.test (rk.temp.frame[[i]], rk.temp.frame[[j]], method="<? getRK ("method"); ?>")
+				t <- cor.test (rk.temp.frame[[i]], rk.temp.frame[[j]], method=<? echo ($method); ?>)
 				rk.temp.p[i, j] <<- t$p.value
 				rk.temp.p[j, i] <<- sum (complete.cases (rk.temp.frame[[i]], rk.temp.frame[[j]]))
 			}
@@ -47,13 +52,15 @@
 
 function printout () {
 	global $use;
+	global $method;
+	global $do_p;
 ?>
-rk.header ("Correlation Matrix", parameters=list ("Method", "<? getRK ("method"); ?>", "Exclusion", <? echo ($use); ?>))
+rk.header ("Correlation Matrix", parameters=list ("Method", <? echo ($method); ?>, "Exclusion", <? echo ($use); ?>))
 
 rk.temp <- data.frame (I (sapply (rk.temp.objects, FUN=function (x) rk.get.description (x, is.substitute=TRUE))), as.data.frame (rk.temp))
 rk.results (rk.temp, titles=c ('Coefficient', sapply (rk.temp.objects, rk.get.short.name)))
 
-<?	if (getRK_val ("do_p")) { ?>
+<?	if ($do_p) { ?>
 rk.temp.p <- data.frame (I (sapply (rk.temp.objects, FUN=function (x) rk.get.description (x, is.substitute=TRUE))), as.data.frame (rk.temp.p))
 rk.results (rk.temp.p, titles=c ('n \\ p', sapply (rk.temp.objects, rk.get.short.name)))
 <?	}


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