[Power-commits] r33 - in pkg/sse: . R inst/slowTests/testthat tests/testthat

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Aug 19 15:45:58 CEST 2019


Author: thofab
Date: 2019-08-19 15:45:57 +0200 (Mon, 19 Aug 2019)
New Revision: 33

Modified:
   pkg/sse/ChangeLog
   pkg/sse/DESCRIPTION
   pkg/sse/R/power.R
   pkg/sse/inst/slowTests/testthat/test-advanced.R
   pkg/sse/tests/testthat/test-standard.R
Log:
All minor changes see ChangeLog for details

Modified: pkg/sse/ChangeLog
===================================================================
--- pkg/sse/ChangeLog	2019-08-16 20:37:45 UTC (rev 32)
+++ pkg/sse/ChangeLog	2019-08-19 13:45:57 UTC (rev 33)
@@ -1,9 +1,14 @@
 version 0.7-12 2019/08/13
+	splitting of tests into tests at tests/ and inst/slowTests to
+	  reduce the time used for R CMD check
 	correcting some spelling errors in man pages
 	correcting some spelling in warning/error messages
+	changing the sequence of asserting that arguments are fine for
+	  (argument 'smooth' in plot() and of 'lm.range' in powEx())
+	some resolving of lintr issues (line length etc.)
 version 0.7-11 2019/07/19
 	removing tests of parallel computing since these fail on some
-	systems and since parallel computing is only under development
+	  systems and since parallel computing is only under development
 version 0.7-10 2019/07/01
         update(): corrections that allow updating different aspects of n, theta
 	and xi in combination
@@ -10,7 +15,7 @@
 	refine(): Change argument name 'n.iter' to 'factor' (to show that there
 	  is a difference to n.iter in calc).
 	refine(): Do not change slot 'iter' of the power-object.
-	Handling of forceDivisor, a best guess for the divisor is added based 
+	Handling of forceDivisor, a best guess for the divisor is added based
 	  on the chosen n-values.
 	Refining many test.
 	Adding some test for the current implementation of parallel computing.

Modified: pkg/sse/DESCRIPTION
===================================================================
--- pkg/sse/DESCRIPTION	2019-08-16 20:37:45 UTC (rev 32)
+++ pkg/sse/DESCRIPTION	2019-08-19 13:45:57 UTC (rev 33)
@@ -4,6 +4,8 @@
 Version: 0.7-12
 Author: Thomas Fabbro [aut, cre]
 Maintainer: Thomas Fabbro <thomas.fabbro at unibas.ch>
+URL: http://r-forge.r-project.org/projects/power/
+BugReports: http://r-forge.r-project.org/projects/power/
 Description: Provides functions to evaluate user-defined power functions for a parameter range, and draws a sensitivity plot. It also provides a resampling procedure for semi-parametric sample size estimation and methods for adding information to a Sweave report.
 License: GPL-3
 LazyLoad: yes

Modified: pkg/sse/R/power.R
===================================================================
--- pkg/sse/R/power.R	2019-08-16 20:37:45 UTC (rev 32)
+++ pkg/sse/R/power.R	2019-08-19 13:45:57 UTC (rev 33)
@@ -661,7 +661,8 @@
                   new.calc <- TRUE
                   any.change <- TRUE
                 } else if (!new.calc
-                           & any(!(round(slot(newObj, s), 10) %in% round(slot(object, s), 10)))) {
+                           & any(!(round(slot(newObj, s), 10)
+                             %in% round(slot(object, s), 10)))) {
                   message(strwrap(
                       "It contains some available elements ->
                        Ony the new elements will be calculated.",
@@ -669,8 +670,10 @@
                   ## --- increase theta
                   increase.theta <- TRUE
                 } else if (!new.calc
-                           & all(round(slot(newObj, s), 10) %in% round(slot(object, s), 10))
-                           & length(slot(newObj, s) < length(slot(object, s)))) {
+                           & all(round(slot(newObj, s), 10)
+                                 %in% round(slot(object, s), 10))
+                           & length(slot(newObj, s)
+                                    < length(slot(object, s)))) {
                   message(strwrap(
                       "It contains only available elements ->
                        No new elements will be calculated.",
@@ -713,17 +716,19 @@
                       prefix = " ", initial = ""))
                   increase.xi <- TRUE
                 } else if (!new.calc
-                           & all(round(slot(newObj, s), 10) %in% round(slot(object, s), 10))
-                           & length(slot(newObj, s) < length(slot(object, s)))) {
+                           & all(round(slot(newObj, s), 10)
+                                 %in% round(slot(object, s), 10))
+                           & length(slot(newObj, s)
+                                    < length(slot(object, s)))) {
                   message(strwrap(
                       "It contains only available elements ->
                        No new elements will be evaluated.",
                       prefix = " ", initial = ""))
                   ## --- shrink xi
-                    takeElements <-
-                    round(slot(newObj, s), 10) %in% round(slot(object, s), 10)
-                  giveElements <-
-                    round(slot(object, s), 10) %in% round(slot(newObj, s), 10)
+                  takeElements <- (round(slot(newObj, s), 10)
+                    %in% round(slot(object, s), 10))
+                  giveElements <- (round(slot(object, s), 10)
+                    %in% round(slot(newObj, s), 10))
                   takeObj at core <- array(NA,
                                         dim = c(length(takeObj at n),
                                                 length(takeObj at theta),
@@ -1122,7 +1127,8 @@
             ##   ## if (powFun.info at return.power){
             ##   ##   size.array <- array(NA, dim = c(dim(object), n.size))
             ##   ## } else {
-            ##   ##   size.array <- array(NA, dim = c(dim(object), n.size, n.iter))
+            ##   ##   size.array <- array(NA,
+            ##                            dim = c(dim(object), n.size, n.iter))
             ##   ## }
  ##           } else {
               x at return.list <- FALSE
@@ -1838,20 +1844,19 @@
   } else {
     ## for method "default" or "lm" we set the lm.range to 0.2 or if provided
     ## test it.
-    if (is.na(lm.range)) {
-      lm.range <- 0.2
-    } else {
-      if (length(lm.range) > 1){
+    if (length(lm.range) > 1) {
         warning(strwrap(
             "The argument 'lm.range' should have a length of one.
              Only the first element is used",
             prefix = " ", initial = ""))
         lm.range <- lm.range[1]
-      }
-      if (lm.range < 0 | lm.range > 1){
-        stop("The argument 'lm.range' should be in the range [0; 1]")
-      }
     }
+    if (is.na(lm.range)) {
+      lm.range <- 0.2
+    } 
+    if (lm.range < 0 | lm.range > 1){
+      stop("The argument 'lm.range' should be in the range [0; 1]")
+    }
   }
   ## --- forceDivisor
   ## handle forceDivisor and generate divisor
@@ -1925,6 +1930,10 @@
 
   # ---
   ## handling the smooth-argument
+  if (length(smooth) > 1) {
+    warning("Only the first element of <smooth> is used.")
+    smooth <- smooth[1]
+  }
   if (is.logical(smooth) & smooth) {
     span <- 0.75
     dat[!is.na(dat$power) & dat$power > 0 & dat$power < 1, "power"] <- fitted(
@@ -1933,10 +1942,6 @@
               span = span))
   }
   if (is.numeric(smooth)) {
-    if (length(smooth) > 1) {
-      warning("Only the first element of <smooth> is used.")
-      smooth <- smooth[1]
-    }
     if (smooth <= 0) {
       stop(strwrap(
           "The argument 'smooth' has to be > 0,

Modified: pkg/sse/inst/slowTests/testthat/test-advanced.R
===================================================================
--- pkg/sse/inst/slowTests/testthat/test-advanced.R	2019-08-16 20:37:45 UTC (rev 32)
+++ pkg/sse/inst/slowTests/testthat/test-advanced.R	2019-08-19 13:45:57 UTC (rev 33)
@@ -110,7 +110,8 @@
 test_that("List as return", {
   powFun.list <- function(psi){
     a <- sample(pp(psi, "F.hat"), size = n(psi) / 2, replace = TRUE)
-    b <- sample(pp(psi, "F.hat"), size = n(psi) / 2, replace = TRUE) + theta(psi)
+    b <- sample(pp(psi, "F.hat"),
+                size = n(psi) / 2, replace = TRUE) + theta(psi)
     w <- wilcox.test(a, b)$p.value < 0.05
     t <- t.test(a, b)$p.value < 0.05
     length(c(a,b) %% 2)

Modified: pkg/sse/tests/testthat/test-standard.R
===================================================================
--- pkg/sse/tests/testthat/test-standard.R	2019-08-16 20:37:45 UTC (rev 32)
+++ pkg/sse/tests/testthat/test-standard.R	2019-08-19 13:45:57 UTC (rev 33)
@@ -125,9 +125,17 @@
 inspect(powEx(calc.resample, theta = 1, power = 0.9, method = "step"))
 inspect(powEx(calc.resample2, theta = 1, power = 0.9, method = "step"))
 
-inspect(powEx(calc.resample2, theta = 1, power = 0.9, method = "step", forceDivisor = 2))
+inspect(powEx(calc.resample2,
+              theta = 1,
+              power = 0.9,
+              method = "step",
+              forceDivisor = 2))
 inspect(
-    powEx(calc.resample2, theta = 1, power = 0.9, method = "step", forceDivisor = TRUE)
+    powEx(calc.resample2,
+          theta = 1,
+          power = 0.9,
+          method = "step",
+          forceDivisor = TRUE)
 )
 
 



More information about the Power-commits mailing list