[Gsdesign-commits] r379 - in pkg/gsDesign: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jan 20 13:58:25 CET 2016


Author: keaven
Date: 2016-01-20 13:58:24 +0100 (Wed, 20 Jan 2016)
New Revision: 379

Modified:
   pkg/gsDesign/DESCRIPTION
   pkg/gsDesign/NAMESPACE
   pkg/gsDesign/NEWS
   pkg/gsDesign/R/gsSurv.R
   pkg/gsDesign/R/gsqplot.R
   pkg/gsDesign/man/nSurv.Rd
   pkg/gsDesign/man/sflogistic.Rd
Log:
Minor updates related to xtable update

Modified: pkg/gsDesign/DESCRIPTION
===================================================================
--- pkg/gsDesign/DESCRIPTION	2015-08-29 15:45:14 UTC (rev 378)
+++ pkg/gsDesign/DESCRIPTION	2016-01-20 12:58:24 UTC (rev 379)
@@ -1,12 +1,13 @@
 Package: gsDesign
-Version: 2.9-4
+Version: 3.0-0
 Title: Group Sequential Design
 Author: Keaven Anderson 
 Maintainer: Keaven Anderson <keaven_anderson at merck.com>
-Depends: R (>= 3.0.0), ggplot2, xtable, stringr, RUnit, plyr
+Depends: R (>= 3.0.0), xtable, ggplot2
+Imports: plyr
 Suggests: knitr, scales
 VignetteBuilder: knitr 
-Description: Derives group sequential designs and describes their properties
+Description: Derives group sequential designs and describes their properties.
 License: GPL (>= 2)
 Copyright: Copyright 2010, Merck Research Laboratories
 Packaged: 2011-12-30 13:26:23 UTC; Anderkea

Modified: pkg/gsDesign/NAMESPACE
===================================================================
--- pkg/gsDesign/NAMESPACE	2015-08-29 15:45:14 UTC (rev 378)
+++ pkg/gsDesign/NAMESPACE	2016-01-20 12:58:24 UTC (rev 379)
@@ -1,5 +1,5 @@
 useDynLib(gsDesign)
-import(RUnit,ggplot2,plyr,stringr,xtable )
+import(plyr, xtable, ggplot2)
 export(gsBoundCP, gsCP, gsPP, gsPI, gsPOS, gsCPOS, gsDensity, gsPosterior)
 export(gsCPz, gsHR, gsDelta, gsBValue, gsRR, hrn2z, hrz2n, zn2hr)
 export(gsBound, gsBound1, gsDesign, gsProbability)
@@ -15,3 +15,20 @@
 export(sfCauchy, sfNormal, sfTDist, spendingFunction)
 export(checkScalar, checkVector, checkRange, checkLengths, isInteger)
 export(eEvents, print.eEvents, nSurv, gsSurv, print.nSurv, print.gsSurv, tEventsIA, nEventsIA)
+S3method(summary,gsDesign)
+S3method(summary,spendfn)
+
+S3method(print,gsDesign)
+S3method(print,gsProbability)
+S3method(print,nSurv)
+S3method(print,gsSurv)
+S3method(print,nSurvival)
+S3method(print,gsBoundSummary)
+S3method(print,eEvents)
+
+S3method(plot,gsDesign)
+S3method(plot,gsProbability)
+S3method(plot,binomialSPRT)
+S3method(plot,gsBinomialExact)
+S3method(plot,ssrCP)
+S3method(xtable,gsSurv)

Modified: pkg/gsDesign/NEWS
===================================================================
--- pkg/gsDesign/NEWS	2015-08-29 15:45:14 UTC (rev 378)
+++ pkg/gsDesign/NEWS	2016-01-20 12:58:24 UTC (rev 379)
@@ -10,3 +10,12 @@
 
 2.9-4, July, 2015
 - Added initial version of nBinomial1Sample to compute sample size and power for 1-sample binomial testing.
+
+3.0-0, December, 2015
+- Updated xtable extension to meet R standards for extensions. 
+- Fixed xtable.gsSurv and print.gsSurv to work with 1-sided designs
+- Update to calls to ggplot to replace show_guide (deprecated) with show.legend arguments where used in geom_text (function from ggplot2 package) calls; no user impact
+- Minor typo fixed in sfLogistic help file
+- Cleaned up "imports" and "depends" in an effort to be an R "good citizen"
+- Registered S3 methods in NAMESPACE
+

Modified: pkg/gsDesign/R/gsSurv.R
===================================================================
--- pkg/gsDesign/R/gsSurv.R	2015-08-29 15:45:14 UTC (rev 378)
+++ pkg/gsDesign/R/gsSurv.R	2016-01-20 12:58:24 UTC (rev 379)
@@ -629,11 +629,18 @@
         if (length(x$ratio)>1) cat("(randomization ratios shown by strata)\n")
   }
   print.gsDesign(x)
-  y<-cbind(x$T,(x$eNC+x$eNE)%*%array(1,ncol(x$eNE)),
-           (x$eDC+x$eDE)%*%array(1,ncol(x$eNE)),
-           round(zn2hr(x$lower$bound,x$n.I,x$ratio,hr0=x$hr0,hr1=x$hr),3),
-           round(zn2hr(x$upper$bound,x$n.I,x$ratio,hr0=x$hr0,hr1=x$hr),3))
-  colnames(y)<-c("T","n","Events","HR futility","HR efficacy")
+  if(x$test.type != 1){
+    y<-cbind(x$T,(x$eNC+x$eNE)%*%array(1,ncol(x$eNE)),
+            (x$eDC+x$eDE)%*%array(1,ncol(x$eNE)),
+            round(zn2hr(x$lower$bound,x$n.I,x$ratio,hr0=x$hr0,hr1=x$hr),3),
+            round(zn2hr(x$upper$bound,x$n.I,x$ratio,hr0=x$hr0,hr1=x$hr),3))
+    colnames(y)<-c("T","n","Events","HR futility","HR efficacy")
+  }else{  
+    y<-cbind(x$T,(x$eNC+x$eNE)%*%array(1,ncol(x$eNE)),
+                   (x$eDC+x$eDE)%*%array(1,ncol(x$eNE)),
+                   round(zn2hr(x$upper$bound,x$n.I,x$ratio,hr0=x$hr0,hr1=x$hr),3))
+    colnames(y)<-c("T","n","Events","HR efficacy")
+  }
   rnames<-paste("IA",1:(x$k))
   rnames[length(rnames)]<-"Final"
   rownames(y)<-rnames
@@ -654,7 +661,7 @@
   }
 }
 xtable.gsSurv <- function(x, caption=NULL, label=NULL, align=NULL, digits=NULL,
-                          display=NULL, footnote=NULL, fnwid="9cm", timename="months",...){
+                          display=NULL, auto=FALSE, footnote=NULL, fnwid="9cm", timename="months",...){
   k <- x$k
   stat <- c("Z-value","HR","p (1-sided)", paste("P\\{Cross\\} if HR=",x$hr0,sep=""),
             paste("P\\{Cross\\} if HR=",x$hr,sep=""))
@@ -671,34 +678,40 @@
   an[5*(0:(k-1))+2]<- paste("N:",ceiling(rowSums(x$eNC))+ceiling(rowSums(x$eNE)))
   an[5*(0:(k-1))+3]<- paste("Events:",ceiling(rowSums(x$eDC+x$eDE)))
   an[5*(0:(k-1))+4]<- paste(round(x$T,1),timename,sep=" ")
-  fut[5*(0:(k-1))+1]<- as.character(round(x$lower$bound,2))
+  if (x$test.type != 1) fut[5*(0:(k-1))+1]<- as.character(round(x$lower$bound,2))
   eff[5*(0:(k-1))+1]<- as.character(round(x$upper$bound,2)) 
-  fut[5*(0:(k-1))+2]<- as.character(round(gsHR(z=x$lower$bound,i=1:k,x,ratio=x$ratio)*x$hr0,2))
+  if (x$test.type != 1) fut[5*(0:(k-1))+2]<- as.character(round(gsHR(z=x$lower$bound,i=1:k,x,ratio=x$ratio)*x$hr0,2))
   eff[5*(0:(k-1))+2]<- as.character(round(gsHR(z=x$upper$bound,i=1:k,x,ratio=x$ratio)*x$hr0,2)) 
   asp <- as.character(round(pnorm(-x$upper$bound),4))
   asp[asp=="0"]<-"$< 0.0001$"
   eff[5*(0:(k-1))+3] <- asp
-  bsp <- as.character(round(pnorm(-x$lower$bound),4))
-  bsp[bsp=="0"]<-" $< 0.0001$"
-  fut[5*(0:(k-1))+3] <- bsp
   asp <- as.character(round(cumsum(x$upper$prob[,1]),4))
   asp[asp=="0"]<-"$< 0.0001$"
   eff[5*(0:(k-1))+4] <- asp
-  bsp <- as.character(round(cumsum(x$lower$prob[,1]),4))
-  bsp[bsp=="0"]<-"$< 0.0001$"
-  fut[5*(0:(k-1))+4] <- bsp
   asp <- as.character(round(cumsum(x$upper$prob[,2]),4))
   asp[asp=="0"]<-"$< 0.0001$"
   eff[5*(0:(k-1))+5] <- asp
-  bsp <- as.character(round(cumsum(x$lower$prob[,2]),4))
-  bsp[bsp=="0"]<-"$< 0.0001$"
-  fut[5*(0:(k-1))+5] <- bsp
+  if (x$test.type != 1) {
+    bsp <- as.character(round(pnorm(-x$lower$bound),4))
+    bsp[bsp=="0"]<-" $< 0.0001$"
+    fut[5*(0:(k-1))+3] <- bsp
+    bsp <- as.character(round(cumsum(x$lower$prob[,1]),4))
+    bsp[bsp=="0"]<-"$< 0.0001$"
+    fut[5*(0:(k-1))+4] <- bsp
+    bsp <- as.character(round(cumsum(x$lower$prob[,2]),4))
+    bsp[bsp=="0"]<-"$< 0.0001$"
+    fut[5*(0:(k-1))+5] <- bsp
+  }
   neff <- length(eff)
   if (!is.null(footnote)) eff[neff] <- 
     paste(eff[neff],"\\\\ \\hline \\multicolumn{4}{p{",fnwid,"}}{\\footnotesize",footnote,"}")
-  xxtab <- data.frame(cbind(an,stat,fut,eff))
-  colnames(xxtab) <- c("Analysis","Value","Futility","Efficacy")
+  if (x$test.type != 1){ 
+    xxtab <- data.frame(cbind(an,stat,fut,eff))
+    colnames(xxtab) <- c("Analysis","Value","Futility","Efficacy")
+  }else{
+    xxtab <- data.frame(cbind(an,stat,eff))
+    colnames(xxtab) <- c("Analysis","Value","Efficacy")
+  }
   return(xtable(xxtab, caption=caption, label=label, align=align, digits=digits,
-                display=display,...))
+                display=display,auto=auto,...))
 }
-

Modified: pkg/gsDesign/R/gsqplot.R
===================================================================
--- pkg/gsDesign/R/gsqplot.R	2015-08-29 15:45:14 UTC (rev 378)
+++ pkg/gsDesign/R/gsqplot.R	2016-01-20 12:58:24 UTC (rev 379)
@@ -198,7 +198,7 @@
 		if (x$test.type > 1)
 		{ p <- ggplot(data=y, aes(x=as.numeric(N), y=as.numeric(Z), group=factor(Bound),
             	col=factor(Bound), label=Ztxt, lty=factor(Bound))) +
-            	geom_text(show_guide=F,size=cex*5)+geom_line()  +
+            	geom_text(show.legend=F,size=cex*5)+geom_line()  +
             	scale_x_continuous(xlab)+scale_y_continuous(ylab) +
   			scale_colour_manual(name= "Bound", values=col, labels=lbls, breaks=lbls) +
 			scale_linetype_manual(name= "Bound", values=lty, labels=lbls, breaks=lbls)
@@ -230,14 +230,14 @@
 			{	text(x=y2$N, y=y2$Z, paste(array("r=",x$k), y2$Ztxt, sep=""), cex=cex)
 			}else
 			{	y2$Ztxt <- paste(array("r=",x$k), y2$Ztxt, sep="")
-				p <- p + geom_text(data=y2, aes(group=factor(Bound), label=Ztxt), size=cex*5, show_guide=F, colour=1)
+				p <- p + geom_text(data=y2, aes(group=factor(Bound), label=Ztxt), size=cex*5, show.legend=F, colour=1)
 			}
 		}else
 		{	if(base)
 			{	text(x=y2$N, y=y2$Z, paste(array("N=",x$k), y2$Ztxt, sep=""), cex=cex)
 			}else
 			{	y2$Ztxt <- paste(array("N=",x$k), y2$Ztxt, sep="")
-				p <- p + geom_text(data=y2, aes(group=factor(Bound),label=Ztxt), size=cex*5, show_guide=F, colour=1)
+				p <- p + geom_text(data=y2, aes(group=factor(Bound),label=Ztxt), size=cex*5, show.legend=F, colour=1)
 			}
 	}	}
 	if (base)
@@ -338,7 +338,7 @@
 		{	lbls <- c("Lower","Upper")
       p <- ggplot(data=y, aes(x=as.numeric(N), y=as.numeric(CP), group=factor(Bound),
         col=factor(Bound), label=Ztxt, lty=factor(Bound))) +
-        geom_text(show_guide=F, size=cex*5)+geom_line() + 
+        geom_text(show.legend=F, size=cex*5)+geom_line() + 
         scale_x_continuous(xlab)+scale_y_continuous(ylab)  +
   	    scale_colour_manual(name= "Bound", values=col, labels=lbls, breaks=lbls) +
 		    scale_linetype_manual(name= "Bound", values=lty, labels=lbls, breaks=lbls)
@@ -719,7 +719,7 @@
          scale_linetype_manual(name="Probability", values=lty, breaks=1:2,
                                labels=c("Upper bound","1-Lower bound"))
      }
-     p <- p + geom_text(data=yt, aes(theta, prob, colour=factor(bound), group=1, label=itxt), size=cex*5, show_guide=F)
+     p <- p + geom_text(data=yt, aes(theta, prob, colour=factor(bound), group=1, label=itxt), size=cex*5, show.legend=F)
      for(i in 1:x$k) p <- p + geom_line(data=subset(y,interim==i&bound==1), 
                                         colour=col[1], lty=lty[1], lwd=lwd[1])
      if (test.type > 2) for(i in 1:(x$k-1)) {

Modified: pkg/gsDesign/man/nSurv.Rd
===================================================================
--- pkg/gsDesign/man/nSurv.Rd	2015-08-29 15:45:14 UTC (rev 378)
+++ pkg/gsDesign/man/nSurv.Rd	2016-01-20 12:58:24 UTC (rev 379)
@@ -39,7 +39,7 @@
   tol = .Machine$double.eps^0.25)
 \method{print}{gsSurv}(x,digits=2,...)
 \method{xtable}{gsSurv}(x, caption=NULL, label=NULL, align=NULL, digits=NULL,
-       display=NULL, footnote=NULL, fnwid="9cm", timename="months",...)
+       display=NULL, auto=FALSE, footnote=NULL, fnwid="9cm", timename="months",...)
 tEventsIA(x, timing=.25, tol = .Machine$double.eps^0.25)
 nEventsIA(tIA=5, x=NULL, target=0, simple=TRUE)
 }
@@ -104,6 +104,7 @@
 \item{label}{passed through to generic \code{xtable()}.}
 \item{align}{passed through to generic \code{xtable()}.}
 \item{display}{passed through to generic \code{xtable()}.}
+\item{auto}{passed through to generic \code{xtable()}.}
 \item{...}{other arguments that may be passed to generic functions underlying the methods here.}
 }
 

Modified: pkg/gsDesign/man/sflogistic.Rd
===================================================================
--- pkg/gsDesign/man/sflogistic.Rd	2015-08-29 15:45:14 UTC (rev 378)
+++ pkg/gsDesign/man/sflogistic.Rd	2016-01-20 12:58:24 UTC (rev 379)
@@ -57,7 +57,7 @@
 \eqn{F^{-1}()} is its inverse.
 
 For the logistic spending function this simplifies to
-\deqn{f(t;\alpha,a,b)\alpha (1-(1+e^a(t/(1-t))^b)^{-1}).}
+\deqn{f(t;\alpha,a,b)=\alpha (1-(1+e^a(t/(1-t))^b)^{-1}).}
 
 For the extreme value distribution with \deqn{F(x)=\exp(-\exp(-x))} this simplifies to 
 \deqn{f(t;\alpha,a,b)=\alpha \exp(-e^a (-\ln t)^b).} 



More information about the Gsdesign-commits mailing list