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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Wed Feb 28 13:12:33 UTC 2007


Revision: 1503
          http://svn.sourceforge.net/rkward/?rev=1503&view=rev
Author:   tfry
Date:     2007-02-28 05:12:33 -0800 (Wed, 28 Feb 2007)

Log Message:
-----------
Add rk.describe.alternative for dealing with htests

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-02-28 05:57:49 UTC (rev 1502)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/R/public.R	2007-02-28 13:12:33 UTC (rev 1503)
@@ -208,6 +208,25 @@
 	cat ("<pre>", paste (x, collapse="\n"), "</pre>\n", sep="", file=rk.get.output.html.file(), append=TRUE);
 }
 
+# Describe the alternative (H1) of an htest.
+# This code adapted from stats:::print.htest
+"rk.describe.alternative" <- function (x) {
+	res <- ""
+	if (!is.null(x$alternative)) {
+		if (!is.null(x$null.value)) {
+ 			if (length(x$null.value) == 1) {
+ 				alt.char <- switch(x$alternative, two.sided = "not equal to", less = "less than", greater = "greater than")
+ 				res <- paste ("true", names(x$null.value), "is", alt.char, x$null.value)
+ 			} else {
+ 				res <- paste (x$alternative, "\nnull values:\n", x$null.value)
+ 			}
+		} else {
+			res <-  (x$alternative)
+		}
+	}
+	res
+}
+
 "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