[rkward-cvs] SF.net SVN: rkward:[2631] trunk/rkward/rkward

tfry at users.sourceforge.net tfry at users.sourceforge.net
Wed Aug 26 09:49:42 UTC 2009


Revision: 2631
          http://rkward.svn.sourceforge.net/rkward/?rev=2631&view=rev
Author:   tfry
Date:     2009-08-26 09:49:42 +0000 (Wed, 26 Aug 2009)

Log Message:
-----------
Extend rk.header to support several levels of headlines (used in n to 1 crosstabs). 
Also allow more sane specifcation of the 'parameters'-parameter.

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/analysis/crosstab.php
    trunk/rkward/rkward/rbackend/rpackages/rkward/R/public.R
    trunk/rkward/rkward/rbackend/rpackages/rkward/R/ver.R
    trunk/rkward/rkward/resource.ver
    trunk/rkward/rkward/version.h

Modified: trunk/rkward/rkward/plugins/analysis/crosstab.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/crosstab.php	2009-08-26 09:17:24 UTC (rev 2630)
+++ trunk/rkward/rkward/plugins/analysis/crosstab.php	2009-08-26 09:49:42 UTC (rev 2631)
@@ -42,18 +42,19 @@
 
 function doPrintout ($final) {
 	if ($final) { ?>
+rk.header ("Crosstabs (n to 1)", level=1)
 for (i in 1:length (results)) {
-	rk.header ("Crosstabs (n to 1)", parameters=list ("Dependent", descriptions[[i]][['Dependent']], "Independent", descriptions[[i]][['Independent']]))
+	rk.header ("Crosstabs (n to 1)", parameters=list ("Dependent", descriptions[[i]][['Dependent']], "Independent", descriptions[[i]][['Independent']]), level=2)
 	rk.results (results[[i]], titles=c(descriptions[[i]][['Dependent']], descriptions[[i]][['Independent']]))
 <?		if (getRK_val ("chisq") == "TRUE") { ?>
 
-	rk.header ("Pearson's Chi Square Test for Crosstabs", list ("Dependent", descriptions[[i]][['Dependent']], "Independent", descriptions[[i]][['Independent']], "Method", chisquares[[i]][["method"]]))
+	rk.header ("Pearson's Chi Square Test for Crosstabs", list ("Dependent", descriptions[[i]][['Dependent']], "Independent", descriptions[[i]][['Independent']], "Method", chisquares[[i]][["method"]]), level=2)
 	rk.results (list ('Statistic'=chisquares[[i]][['statistic']], 'df'=chisquares[[i]][['parameter']], 'p'=chisquares[[i]][['p.value']]))
 <?		}
 
 		if (getRK_val ("barplot") == "TRUE") { ?>
 
-	rk.header ("Barplot for Crosstabs", list ("Dependent", descriptions[[i]][['Dependent']], "Independent", descriptions[[i]][['Independent']]<? getRK ('barplot_embed.code.preprocess'); ?>))
+	rk.header ("Barplot for Crosstabs", list ("Dependent", descriptions[[i]][['Dependent']], "Independent", descriptions[[i]][['Independent']]<? getRK ('barplot_embed.code.preprocess'); ?>), level=2)
 	rk.graph.on ()
 	try ({
 <?			printIndented ("\t\t", getRK_val ('barplot_embed.code.printout')); ?>

Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/R/public.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/R/public.R	2009-08-26 09:17:24 UTC (rev 2630)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/R/public.R	2009-08-26 09:49:42 UTC (rev 2631)
@@ -156,22 +156,32 @@
 	}
 }
 
-"rk.header" <- function (title, parameters=list ()) {
+"rk.header" <- function (title, parameters=list (), level=1) {
 	sink (rk.get.output.html.file(), append=TRUE)
 	on.exit (sink ())
 
-	cat (paste ("<h1>", title, "</h1>\n", sep=""))
+	cat ("<h", level, ">", title, "</h", level, ">\n", sep="")
+	# legacy handling: parameter=value used to be passed as parameter, value
+	if (!is.null (names (parameters))) {
+		pnames <- names (parameters)
+		p <- list ()
+		for (i in 1:length (parameters)) {
+			p[i*2-1] <- pnames[i]
+			p[i*2] <- parameters[i]
+		}
+		parameters <- p
+	}
 	if (length (parameters)) {
-		cat ("<h2>Parameters</h2>\n<ul>")
+		cat ("<h", level + 1, ">Parameters</h", level + 1, ">\n<ul>", sep="")
 		len <- length (parameters)
 		i <- 2
 		while (i <= len) {
-			cat (paste ("<li>", parameters[i-1], ": ", parameters[i], "</li>\n", sep=""))
+			cat ("<li>", parameters[[i-1]], ": ", parameters[[i]], "</li>\n", sep="")
 			i <- i + 2
 		}
 		cat ("</ul>\n")
 	}
-	cat (date ())
+	if (level==1) cat (date ())
 	cat ("<br>\n")
 }
 

Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/R/ver.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/R/ver.R	2009-08-26 09:17:24 UTC (rev 2630)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/R/ver.R	2009-08-26 09:49:42 UTC (rev 2631)
@@ -1 +1 @@
-".rk.app.version" <- "0.5.2-pre1"
+".rk.app.version" <- "0.5.2-svn1"

Modified: trunk/rkward/rkward/resource.ver
===================================================================
--- trunk/rkward/rkward/resource.ver	2009-08-26 09:17:24 UTC (rev 2630)
+++ trunk/rkward/rkward/resource.ver	2009-08-26 09:49:42 UTC (rev 2631)
@@ -1 +1 @@
-0.5.2-pre1
+0.5.2-svn1

Modified: trunk/rkward/rkward/version.h
===================================================================
--- trunk/rkward/rkward/version.h	2009-08-26 09:17:24 UTC (rev 2630)
+++ trunk/rkward/rkward/version.h	2009-08-26 09:49:42 UTC (rev 2631)
@@ -1,2 +1,2 @@
 /* Version number of package */
-#define VERSION "0.5.2-pre1"
+#define VERSION "0.5.2-svn1"


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