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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Sep 23 21:26:26 CEST 2019


Author: thofab
Date: 2019-09-23 21:26:26 +0200 (Mon, 23 Sep 2019)
New Revision: 38

Modified:
   pkg/sse/ChangeLog
   pkg/sse/DESCRIPTION
   pkg/sse/R/power.R
   pkg/sse/inst/slowTests/testthat.R
   pkg/sse/inst/slowTests/testthat/test-updateResample.R
   pkg/sse/man/update.Rd
   pkg/sse/tests/testthat.R
Log:
All minor changes see ChangeLog for details

Modified: pkg/sse/ChangeLog
===================================================================
--- pkg/sse/ChangeLog	2019-08-22 12:03:16 UTC (rev 37)
+++ pkg/sse/ChangeLog	2019-09-23 19:26:26 UTC (rev 38)
@@ -1,3 +1,7 @@
+version 0.7-14 2019/0
+	adding error message in update() if n.iter is smaller than
+          available (also adding corresponding test)
+	DESCRIPTION: removing 'lintr' from Suggests
 version 0.7-13 2019/08/22
 	vignette: removing unused options
 	man pages: several changes to harmonize wording and improve structure

Modified: pkg/sse/DESCRIPTION
===================================================================
--- pkg/sse/DESCRIPTION	2019-08-22 12:03:16 UTC (rev 37)
+++ pkg/sse/DESCRIPTION	2019-09-23 19:26:26 UTC (rev 38)
@@ -1,7 +1,7 @@
 Package: sse
 Type: Package
 Title: Sample Size Estimation
-Version: 0.7-13
+Version: 0.7-14
 Author: Thomas Fabbro [aut, cre]
 Maintainer: Thomas Fabbro <thomas.fabbro at unibas.ch>
 URL: http://r-forge.r-project.org/projects/power/
@@ -10,5 +10,5 @@
 License: GPL-3
 LazyLoad: yes
 Imports: methods, grid, lattice, graphics, stats, parallel
-Suggests: testthat, lintr
+Suggests: testthat
 NeedsCompilation: no

Modified: pkg/sse/R/power.R
===================================================================
--- pkg/sse/R/power.R	2019-08-22 12:03:16 UTC (rev 37)
+++ pkg/sse/R/power.R	2019-09-23 19:26:26 UTC (rev 38)
@@ -559,13 +559,24 @@
                      The provided value will not be used.",
                     prefix = " ", initial = ""))  
                 n.iter <- as.integer(NA)
+              } else {
+                ## ans else statement is used here because only further
+                ## warnings or errors should be given if n.iter is used
+                n.iter <- dots[["n.iter"]]
+                if (length(n.iter) > 1){
+                  warning("Only the first element of 'n.iter' is used")
+                  n.iter <- n.iter[1]
+                }
+                n.iter <- as.integer(n.iter)
+                ## n.iter must be at least as in previous runs
+                if (!is.na(n.iter) & n.iter < object at iter) {
+                  stop(strwrap(gettextf(
+                      "The number of iterations must be equal >= %s.",
+                      (object at iter)),
+                      prefix = " ", initial = ""),
+                      call. = FALSE)
+                }
               }
-              n.iter <- dots[["n.iter"]]
-              if (length(n.iter) > 1){
-                warning("Only the first element of 'n.iter' is used")
-                n.iter <- n.iter[1]
-              }
-              n.iter <- as.integer(n.iter)
             } else {
               ## that does not meen that no iterations are done
               n.iter <- as.integer(NA)

Modified: pkg/sse/inst/slowTests/testthat/test-updateResample.R
===================================================================
--- pkg/sse/inst/slowTests/testthat/test-updateResample.R	2019-08-22 12:03:16 UTC (rev 37)
+++ pkg/sse/inst/slowTests/testthat/test-updateResample.R	2019-09-23 19:26:26 UTC (rev 38)
@@ -66,6 +66,10 @@
   expect_warning(
       update(calc1.2.1, n.iter = c(500,100))
   )
+## update of n.iter with value < than available
+  expect_error(
+      update(calc1.2.1, n.iter = 50)
+  )
 })
 
 

Modified: pkg/sse/inst/slowTests/testthat.R
===================================================================
--- pkg/sse/inst/slowTests/testthat.R	2019-08-22 12:03:16 UTC (rev 37)
+++ pkg/sse/inst/slowTests/testthat.R	2019-09-23 19:26:26 UTC (rev 38)
@@ -1,4 +1,3 @@
-library(lintr)
 library(testthat)
 library(sse)
 

Modified: pkg/sse/man/update.Rd
===================================================================
--- pkg/sse/man/update.Rd	2019-08-22 12:03:16 UTC (rev 37)
+++ pkg/sse/man/update.Rd	2019-09-23 19:26:26 UTC (rev 38)
@@ -1,4 +1,4 @@
-\name{update-methods}
+\name{update}
 \docType{methods}
 \alias{update}
 
@@ -19,9 +19,11 @@
     \describe{
       \item{n.iter}{A number indicating the number of iterations used to
 	dertermine the power if the calcualation is based on
-	resamlpling.
-	The existing iterations will be kept. Therefore after evaluation
-	the number of iterations will be \code{n.iter}.}
+	resampling.
+	The existing iterations will be kept. \code{n.iter} indicates
+	the number of iterations after evaluation, therefore
+	\code{n.iter} has to be equal or larger than the existing
+	number of iterations.}
       \item{n}{A vector with numbers for evaluating the power.
 	New elements will be evaluated and existing elements reused.
 	If some elements of the original are not part of \code{n} they

Modified: pkg/sse/tests/testthat.R
===================================================================
--- pkg/sse/tests/testthat.R	2019-08-22 12:03:16 UTC (rev 37)
+++ pkg/sse/tests/testthat.R	2019-09-23 19:26:26 UTC (rev 38)
@@ -1,4 +1,3 @@
-library(lintr)
 library(testthat)
 library(sse)
 



More information about the Power-commits mailing list