[Power-commits] r23 - in pkg/sse: R man tests/testthat

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Apr 6 20:38:35 CEST 2019


Author: thofab
Date: 2019-04-06 20:38:35 +0200 (Sat, 06 Apr 2019)
New Revision: 23

Modified:
   pkg/sse/R/AllGenerics.R
   pkg/sse/R/power.R
   pkg/sse/man/powCalc.Rd
   pkg/sse/tests/testthat/test-advanced.R
   pkg/sse/tests/testthat/test-standard.R
Log:
making the cluster argument of powCalc per default to FALSE because there are problems

Modified: pkg/sse/R/AllGenerics.R
===================================================================
--- pkg/sse/R/AllGenerics.R	2019-04-05 20:47:41 UTC (rev 22)
+++ pkg/sse/R/AllGenerics.R	2019-04-06 18:38:35 UTC (rev 23)
@@ -1,7 +1,7 @@
 
 setGeneric(# calculates the array with the power, stores it into powCalc
     name = "powCalc",
-    def = function(object, statistic, n.iter = NA, cluster = 8){
+    def = function(object, statistic, n.iter = NA, cluster = FALSE){
       standardGeneric("powCalc")
     })
 

Modified: pkg/sse/R/power.R
===================================================================
--- pkg/sse/R/power.R	2019-04-05 20:47:41 UTC (rev 22)
+++ pkg/sse/R/power.R	2019-04-06 18:38:35 UTC (rev 23)
@@ -549,7 +549,7 @@
 
 setMethod("powCalc",
           signature(object="powPar"),
-          definition = function(object, statistic, n.iter = NA, cluster = 8){
+          definition = function(object, statistic, n.iter = NA, cluster = FALSE){
 
             
             ## -----

Modified: pkg/sse/man/powCalc.Rd
===================================================================
--- pkg/sse/man/powCalc.Rd	2019-04-05 20:47:41 UTC (rev 22)
+++ pkg/sse/man/powCalc.Rd	2019-04-06 18:38:35 UTC (rev 23)
@@ -9,7 +9,7 @@
   evaluated for the whole range of \code{n}, \code{theta}, and \code{xi}
   as specified in the \code{powPar}-object.
 }
-\usage{powCalc(object, statistic, n.iter = NA, cluster = 8)}
+\usage{powCalc(object, statistic, n.iter = NA, cluster = FALSE)}
 \arguments{
   \item{object}{An object of class \code{powPar}.}
   \item{statistic}{A function that takes an object of class
@@ -17,10 +17,10 @@
     argument. The function should return a vector of numeric values or a
     vector of logicals, depending on the \code{type}. See Details.}
   \item{n.iter}{A number specifying how often the power-function is evaluated.}
-  \item{cluster}{This argument can be logical, indicating if the
-    library parallel should be used or not or numeric. In the latter
+  \item{cluster}{Still experimental! This argument can be logical, indicating if the
+    library parallel should be used or not, or numeric. In the latter
     case the number is passed as integer to the function makeCluster
-    from library parallel. The default is 8.}
+    from library parallel. The default is FALSE.}
   \item{...}{Not used so far.}
 }
 \details{If the statistic does not return the power (a numeric value

Modified: pkg/sse/tests/testthat/test-advanced.R
===================================================================
--- pkg/sse/tests/testthat/test-advanced.R	2019-04-05 20:47:41 UTC (rev 22)
+++ pkg/sse/tests/testthat/test-advanced.R	2019-04-06 18:38:35 UTC (rev 23)
@@ -1,5 +1,7 @@
 context("Advanced applications")
 
+library(sse)
+library(testthat)
 ### ------------------------------------------------------------------
 ### with pilot data and several endpoints
 pilot.data <- rnorm(1000)

Modified: pkg/sse/tests/testthat/test-standard.R
===================================================================
--- pkg/sse/tests/testthat/test-standard.R	2019-04-05 20:47:41 UTC (rev 22)
+++ pkg/sse/tests/testthat/test-standard.R	2019-04-06 18:38:35 UTC (rev 23)
@@ -21,7 +21,7 @@
 
 ##
 calc.power <- powCalc(psi, statistic = powFun.power)
-calc.resample <- powCalc(psi, statistic = powFun.resample, n.iter = 33, cluster = TRUE)
+calc.resample <- powCalc(psi, statistic = powFun.resample, n.iter = 33)
 
 #
 calc.resample2 <- update(calc.resample, theta = 1, n.iter = 99)
@@ -132,16 +132,16 @@
   expect_error(
       powCalc(seq(from = 0, to = 100, by = 10), powFun1)
   )
-  ## default is using cluster
-  expect_message(
-      calc.resample <- powCalc(psi, statistic = powFun.resample, n.iter = 3, cluster = TRUE)
-     , "using cluster"
-  )
-  ## if cluster = FALSE
-  expect_message(
-      calc.resample <- powCalc(psi, statistic = powFun.resample, n.iter = 3, cluster = FALSE)
-      , "not using cluster"
-  )
+  ## ## default is using cluster
+  ## expect_message(
+  ##     calc.resample <- powCalc(psi, statistic = powFun.resample, n.iter = 3, cluster = TRUE)
+  ##    , "using cluster"
+  ## )
+  ## ## if cluster = FALSE
+  ## expect_message(
+  ##     calc.resample <- powCalc(psi, statistic = powFun.resample, n.iter = 3, cluster = FALSE)
+  ##     , "not using cluster"
+  ## )
 })
 
 



More information about the Power-commits mailing list