[rkward-cvs] SF.net SVN: rkward: [1025] trunk/rkward/rkward/rbackend/rpackages/rkward/R/ public.R

tfry at users.sourceforge.net tfry at users.sourceforge.net
Mon Jan 1 21:53:50 UTC 2007


Revision: 1025
          http://svn.sourceforge.net/rkward/?rev=1025&view=rev
Author:   tfry
Date:     2007-01-01 13:53:50 -0800 (Mon, 01 Jan 2007)

Log Message:
-----------
Adding quick and dirty rk.results function

Modified Paths:
--------------
    trunk/rkward/rkward/rbackend/rpackages/rkward/R/public.R

Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/R/public.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/R/public.R	2007-01-01 20:15:34 UTC (rev 1024)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/R/public.R	2007-01-01 21:53:50 UTC (rev 1025)
@@ -146,6 +146,38 @@
 	cat ("<br>\n")
 }
 
+"rk.results" <- function (x, titles=NULL) {
+	if (is.list (x)) {	# or a data.frame
+		if (is.null (titles)) {
+			titles <- names (x)
+		}
+
+		if (is.data.frame (a)) {
+			cat ("<table border=\"1\">\n<tr>")
+			for (i in 1:length (x)) {
+				cat ("<td>", titles[i], "</td>", sep="")
+			}
+			cat ("</tr>\n")
+			for (row in 1:dim (x)[1]) {
+				cat ("<tr>")
+				for (col in 1:dim (x)[2]) {
+					cat ("<td>", x[row, col], "</td>", sep="")
+				}
+				cat ("</tr>\n")
+			}
+			cat ("</table>\n")
+		} else {
+			stop ("uninmplemented")
+			# TODO: handling for regular lists. 
+			# Should probably output a <ul></ul>
+		}
+	} else {
+		stop ("uninmplemented")
+		# TODO: handling for vectors. 
+		# Should probably output a <ul></ul>
+	}
+}
+
 "rk.make.repos.string" <- function () {
 	x <- options ("repos")$repos
 	len <- length (x)


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