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

m-eik at users.sourceforge.net m-eik at users.sourceforge.net
Mon Dec 12 15:42:53 UTC 2011


Revision: 4104
          http://rkward.svn.sourceforge.net/rkward/?rev=4104&view=rev
Author:   m-eik
Date:     2011-12-12 15:42:52 +0000 (Mon, 12 Dec 2011)
Log Message:
-----------
addition to the correlation matrix -- what do you think?

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/analysis/corr_matrix.js
    trunk/rkward/rkward/plugins/analysis/corr_matrix.xml

Modified: trunk/rkward/rkward/plugins/analysis/corr_matrix.js
===================================================================
--- trunk/rkward/rkward/plugins/analysis/corr_matrix.js	2011-12-12 13:18:00 UTC (rev 4103)
+++ trunk/rkward/rkward/plugins/analysis/corr_matrix.js	2011-12-12 15:42:52 UTC (rev 4104)
@@ -8,6 +8,7 @@
 
 	var exclude_whole = "";
 	var vars = trim (getValue ("x"));
+	var toNumeric = getValue ("to_numeric");
 	use = getValue ("use");
 	if (use == "pairwise") {
 		exclude_whole = false;
@@ -20,7 +21,12 @@
 
 	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 <- as.data.frame (rk.list (' + vars.split ("\n").join (", ") + '), check.names=FALSE)\n');
+	echo ('data.list <- rk.list (' + vars.split ("\n").join (", ") + ')\n');
+	if(toNumeric) {
+		echo ('# Non-numeric variables will be treated as ordered data and transformed into numeric ranks\n');
+		echo ('data.list <- lapply(data.list, function(x){\n\tif(!is.numeric(x)){\n\t\treturn(xtfrm(x))\n\t} else {\n\t\treturn(x)\n\t}})\n');
+	} else {}
+	echo ('data <- as.data.frame (data.list, check.names=FALSE)\n');
 	echo ('\n');
 	echo ('# calculate correlation matrix\n');
 	echo ('result <- cor (data, use=' + use + ', method=' + method + ')\n');

Modified: trunk/rkward/rkward/plugins/analysis/corr_matrix.xml
===================================================================
--- trunk/rkward/rkward/plugins/analysis/corr_matrix.xml	2011-12-12 13:18:00 UTC (rev 4103)
+++ trunk/rkward/rkward/plugins/analysis/corr_matrix.xml	2011-12-12 15:42:52 UTC (rev 4104)
@@ -13,16 +13,17 @@
 				</row>
 			</tab>
 			<tab id="tab_options" label="Options">
-				<checkbox id="do_p" label="Calculate p values" checked="true"/>
+				<checkbox id="do_p" label="Calculate p values" value="true" checked="true" />
 				<radio id="method" label="Method">
-					<option value="pearson" label="Pearson"/>
-					<option value="kendall" label="Kendall"/>
-					<option value="spearman" label="Spearman"/>
+					<option label="Pearson's product-moment correlation" value="pearson" checked="true" />
+					<option label="Kendall's tau" value="kendall" />
+					<option label="Spearman's rho" value="spearman" />
 				</radio>
 				<radio id="use" label="Exclude missing values">
-					<option value="complete" label="whole cases"/>
-					<option value="pairwise" label="pairwise" checked="true"/>
+					<option label="whole cases" value="complete" />
+					<option label="pairwise" value="pairwise" checked="true" />
 				</radio>
+				<checkbox id="to_numeric" label="Transform ordered categorial variables to numeric ranks" value="true" />
 			</tab>
 		</tabbook>
 	</dialog>

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