[rkward-cvs] SF.net SVN: rkward:[3756] trunk/rkward/rkward/rbackend/rpackages/rkward/R/ rk.print-functions.R

tfry at users.sourceforge.net tfry at users.sourceforge.net
Mon Sep 12 09:17:38 UTC 2011


Revision: 3756
          http://rkward.svn.sourceforge.net/rkward/?rev=3756&view=rev
Author:   tfry
Date:     2011-09-12 09:17:38 +0000 (Mon, 12 Sep 2011)
Log Message:
-----------
Simplify rk.header() a bit.

Modified Paths:
--------------
    trunk/rkward/rkward/rbackend/rpackages/rkward/R/rk.print-functions.R

Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/R/rk.print-functions.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/R/rk.print-functions.R	2011-09-12 08:40:40 UTC (rev 3755)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/R/rk.print-functions.R	2011-09-12 09:17:38 UTC (rev 3756)
@@ -101,23 +101,19 @@
 	on.exit (sink ())
 
 	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)) {
+		# legacy handling: parameter=value used to be passed as parameter, value
+		if (is.null (names (parameters))) {
+			s <- seq.int (1, length (parameters), by=2)
+			pnames <- as.character (parameters[s])
+			parameters <- parameters[s+1]
+		} else {
+			pnames <- names (parameters)
+		}
+
 		cat ("<h", level + 1, ">Parameters</h", level + 1, ">\n<ul>", sep="")
-		len <- length (parameters)
-		i <- 2
-		while (i <= len) {
-			cat ("<li>", parameters[[i-1]], ": ", parameters[[i]], "</li>\n", sep="")
-			i <- i + 2
+		for (i in 1:length (parameters)) {
+			cat ("<li>", pnames[i], ": ", parameters[[i]], "</li>\n", sep="")
 		}
 		cat ("</ul>\n")
 	}

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