[Gsdesign-commits] r241 - pkg/gsDesignGUI/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Dec 22 22:58:36 CET 2009


Author: wconstan
Date: 2009-12-22 22:58:36 +0100 (Tue, 22 Dec 2009)
New Revision: 241

Modified:
   pkg/gsDesignGUI/R/gsDesignGUI.R
Log:
GSDG-67

* New R functionality to interface with Qt C++ calls. These functions coordinate also with Keaven's latest version of gsDesign, version 2.2-1.

Modified: pkg/gsDesignGUI/R/gsDesignGUI.R
===================================================================
--- pkg/gsDesignGUI/R/gsDesignGUI.R	2009-12-22 20:53:27 UTC (rev 240)
+++ pkg/gsDesignGUI/R/gsDesignGUI.R	2009-12-22 21:58:36 UTC (rev 241)
@@ -1,3 +1,32 @@
-gsDesignGUI <- function()
+"gsDesignGUI" <- function(x)
 {
-}
\ No newline at end of file
+   # x is a named list of mapped Qt objects
+   z <- gsDesign(k=x$eptIntervalsSpin)
+
+   # form output to send back to Qt
+   gsDesignToQt(z, x)
+}
+
+
+"gsDesignToQt" <- function(x, designList, plotPath=file.path(tempdir(), "gsDesignPlot.png"))
+{
+  if (!is(x, "gsDesign"))
+  {
+    stop("x must be an object of class \"gDesign\"")
+  }
+  
+  # capture textual output
+  outText <- paste(capture.output(print(x)), collapse="\n")
+  
+  # capture graphical output
+  png(file=plotPath, bg="transparent")
+  types <- c("Boundaries", "Power", "Treatment Effect", "Conditional Power", "Spending Function","Expected Sample Size","B-Values")
+  plot(x, plottype=match(designList$opTypeCombo, types))
+  dev.off()
+  
+  list(text=outText, plot=plotPath)
+}
+  
+    
+
+



More information about the Gsdesign-commits mailing list