[Gsdesign-commits] r339 - pkg/gsDesign/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Jan 13 12:33:53 CET 2013


Author: keaven
Date: 2013-01-13 12:33:52 +0100 (Sun, 13 Jan 2013)
New Revision: 339

Modified:
   pkg/gsDesign/R/gsDesign.R
Log:
Replaced "real" with "double" to ensure R 2.3 compatibility

Modified: pkg/gsDesign/R/gsDesign.R
===================================================================
--- pkg/gsDesign/R/gsDesign.R	2013-01-13 11:32:21 UTC (rev 338)
+++ pkg/gsDesign/R/gsDesign.R	2013-01-13 11:33:52 UTC (rev 339)
@@ -259,29 +259,29 @@
 
 "gsPOS" <- function(x, theta, wgts)
 {
-    if (class(x) != "gsProbability" && class(x) != "gsDesign")
-        stop("x must have class gsProbability or gsDesign")
+    if (!is(x,c("gsProbability","gsDesign")))
+      stop("x must have class gsProbability or gsDesign")
     checkVector(theta, "numeric")
     checkVector(wgts, "numeric")
     checkLengths(theta, wgts)    
     x <- gsProbability(theta = theta, d=x)
     one <- array(1, x$k)
-    as.real(one %*% x$upper$prob %*% wgts)
+    as.double(one %*% x$upper$prob %*% wgts)
 }
 
 "gsCPOS" <- function(i, x, theta, wgts)
 {
-    if (class(x) != "gsProbability" && class(x) != "gsDesign")
-        stop("x must have class gsProbability or gsDesign")
+    if (!is(x,c("gsProbability","gsDesign")))
+      stop("x must have class gsProbability or gsDesign")
     checkScalar(i, "integer", c(1, x$k), c(TRUE, FALSE))
     checkVector(theta, "numeric")
     checkVector(wgts, "numeric")
     checkLengths(theta, wgts)    
     x <- gsProbability(theta = theta, d=x)
     v <- c(array(1, i), array(0, (x$k - i)))
-    pAi <- 1 - as.real(v %*% (x$upper$prob + x$lower$prob) %*% wgts)
+    pAi <- 1 - as.double(v %*% (x$upper$prob + x$lower$prob) %*% wgts)
     v <- 1 - v
-    pAiB <- as.real(v %*% x$upper$prob %*% wgts)
+    pAiB <- as.double(v %*% x$upper$prob %*% wgts)
     pAiB / pAi
 }
 
@@ -906,7 +906,7 @@
     b <- d$upper$bound
     r <- d$r
     ntheta <- as.integer(length(theta))
-    theta <- as.real(theta)
+    theta <- as.double(theta)
     
     phi <- as.double(c(1:(k*ntheta)))
     plo <- as.double(c(1:(k*ntheta)))



More information about the Gsdesign-commits mailing list