From b83b67856754957324165e30a8764010d8eb8aec Mon Sep 17 00:00:00 2001 From: "Matthew L. Fidler" Date: Fri, 26 May 2023 09:50:03 -0500 Subject: [PATCH] Address CRAN comments --- .Rbuildignore | 1 + R/nonmem2rx.R | 7 ++++--- R/plot.R | 1 + cran-comments.md | 11 +++++++++++ man/autoplot.nonmem2rx.Rd | 3 +++ man/nonmem2rx.Rd | 7 ++++--- tests/testthat/test-abbrev.R | 4 ++-- tests/testthat/test-bauer-2019.R | 2 +- tests/testthat/test-bauer-2021.R | 2 +- tests/testthat/test-ddmore.R | 2 +- tests/testthat/test-external-models.R | 4 ++-- tests/testthat/test-full-parsing.R | 4 ++-- tests/testthat/test-linCmt.R | 2 +- tests/testthat/test-model-load.R | 4 ++-- tests/testthat/test-nm75.R | 4 ++-- tests/testthat/test-piping.R | 4 ++-- tests/testthat/test-psn.R | 4 ++-- tests/testthat/test-read-nonmemData.R | 8 ++++---- tests/testthat/test-rename.R | 4 ++-- tests/testthat/test-rxsolve.R | 4 ++-- 20 files changed, 50 insertions(+), 32 deletions(-) diff --git a/.Rbuildignore b/.Rbuildignore index c015f86b..41278daa 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -18,3 +18,4 @@ ^docs$ ^pkgdown$ ^cran-comments\.md$ +^CRAN-SUBMISSION$ diff --git a/R/nonmem2rx.R b/R/nonmem2rx.R index eae89341..75519778 100644 --- a/R/nonmem2rx.R +++ b/R/nonmem2rx.R @@ -508,14 +508,15 @@ #' # a faster way to import a dataset (and allows the CRAN machines to #' # run a quick example) #' -#' mod <- nonmem2rx(system.file("mods/cpt/runODE032.ctl", package="nonmem2rx"), lst=".res", save=FALSE, -#' validate=FALSE, compress=FALSE) +#' mod <- nonmem2rx(system.file("mods/cpt/runODE032.ctl", package="nonmem2rx"), lst=".res", +#' save=FALSE, validate=FALSE, compress=FALSE) #' #' \donttest{ #' #' # Though by default you likely wish to validate the input #' -#' mod <- nonmem2rx(system.file("mods/cpt/runODE032.ctl", package="nonmem2rx"), lst=".res", save=FALSE) +#' mod <- nonmem2rx(system.file("mods/cpt/runODE032.ctl", package="nonmem2rx"), +#' lst=".res", save=FALSE) #' #' mod #' diff --git a/R/plot.R b/R/plot.R index f1ce5cf4..973bda3f 100644 --- a/R/plot.R +++ b/R/plot.R @@ -4,6 +4,7 @@ #' @param page number of page(s) for the individual plots, by default #' (`FALSE`) no pages are print; You can use `TRUE` for all pages to #' print, or list which pages you want to print +#' @return a ggplot2 object #' @inheritParams rxode2::plot.rxSolve #' @inheritParams ggplot2::autoplot #' @inheritParams ggforce::facet_wrap_paginate diff --git a/cran-comments.md b/cran-comments.md index 858617db..e88f7403 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,3 +1,14 @@ +> Please add \value to .Rd files regarding exported methods and explain the functions results in the documentation. Please write about the structure of the output (class) and also what the output means. (If a function does not return a value, please document that too, e.g. +> \value{No return value, called for side effects} or similar) Missing Rd-tags: +> autoplot.nonmem2rx.Rd: \value + +Added value + +> Please ensure that your functions do not write by default or in your examples/vignettes/tests in the user's home filespace (including the package directory and getwd()). This is not allowed by CRAN policies. +> Please omit any default path in writing functions. In your examples/vignettes/tests you can write to tempdir(). + +Turned off saving in tests/examples/vignettes. This should fix it + ## R CMD check results 0 errors | 0 warnings | 1 note diff --git a/man/autoplot.nonmem2rx.Rd b/man/autoplot.nonmem2rx.Rd index e23e3bec..3b183ab8 100644 --- a/man/autoplot.nonmem2rx.Rd +++ b/man/autoplot.nonmem2rx.Rd @@ -31,6 +31,9 @@ log-scale?} (\code{FALSE}) no pages are print; You can use \code{TRUE} for all pages to print, or list which pages you want to print} } +\value{ +a ggplot2 object +} \description{ Autoplot nonmem2rx object } diff --git a/man/nonmem2rx.Rd b/man/nonmem2rx.Rd index 08bde1b2..7f62ea79 100644 --- a/man/nonmem2rx.Rd +++ b/man/nonmem2rx.Rd @@ -210,14 +210,15 @@ uncompressed (default: \code{TRUE}) # a faster way to import a dataset (and allows the CRAN machines to # run a quick example) -mod <- nonmem2rx(system.file("mods/cpt/runODE032.ctl", package="nonmem2rx"), lst=".res", save=FALSE, - validate=FALSE, compress=FALSE) +mod <- nonmem2rx(system.file("mods/cpt/runODE032.ctl", package="nonmem2rx"), lst=".res", + save=FALSE, validate=FALSE, compress=FALSE) \donttest{ # Though by default you likely wish to validate the input -mod <- nonmem2rx(system.file("mods/cpt/runODE032.ctl", package="nonmem2rx"), lst=".res", save=FALSE) +mod <- nonmem2rx(system.file("mods/cpt/runODE032.ctl", package="nonmem2rx"), + lst=".res", save=FALSE) mod diff --git a/tests/testthat/test-abbrev.R b/tests/testthat/test-abbrev.R index cd5822fb..fd665cea 100644 --- a/tests/testthat/test-abbrev.R +++ b/tests/testthat/test-abbrev.R @@ -288,8 +288,8 @@ test_that("test abbrev", { # test if1 .ae("IF (EMAX>0) pope0=pope0*EXP(etae0)", "if (EMAX > 0) POPE0 <- theta1 * exp(eta1)", "pope0") withr::with_options(list(nonmem2rx.save=FALSE, nonmem2rx.load=FALSE, nonmem2rx.overwrite=FALSE),{ - .ext <- nonmem2rx(system.file("TheopdExt.ctl", package="nonmem2rx"), extended=TRUE) - .nonExt <- nonmem2rx(system.file("Theopd.ctl", package="nonmem2rx")) + .ext <- nonmem2rx(system.file("TheopdExt.ctl", package="nonmem2rx"), extended=TRUE, save=FALSE) + .nonExt <- nonmem2rx(system.file("Theopd.ctl", package="nonmem2rx"), save=FALSE) .ext1 <- sub("extended", "compare", deparse(as.function(.ext))) .ext2 <- sub("standard", "compare",deparse(as.function(.nonExt))) expect_equal(.ext1, .ext2) diff --git a/tests/testthat/test-bauer-2019.R b/tests/testthat/test-bauer-2019.R index 6c14d082..694e4292 100644 --- a/tests/testthat/test-bauer-2019.R +++ b/tests/testthat/test-bauer-2019.R @@ -32,7 +32,7 @@ if (identical(Sys.getenv("NOT_CRAN"), "true")) { nonmem2rx.extended=FALSE),{ lapply(files,function(x) { test_that(paste(x, ", regular"), { - expect_error(nonmem2rx(system.file(x, package="nonmem2rx")), NA) + expect_error(nonmem2rx(system.file(x, package="nonmem2rx"), save=FALSE), NA) }) }) }) diff --git a/tests/testthat/test-bauer-2021.R b/tests/testthat/test-bauer-2021.R index 3ae75919..aaebf886 100644 --- a/tests/testthat/test-bauer-2021.R +++ b/tests/testthat/test-bauer-2021.R @@ -24,7 +24,7 @@ if (identical(Sys.getenv("NOT_CRAN"), "true")) { nonmem2rx.extended=FALSE),{ lapply(files,function(x) { test_that(paste(x, ", regular"), { - expect_error(suppressMessages(suppressWarnings(nonmem2rx(system.file(x, package="nonmem2rx")))), NA) + expect_error(suppressMessages(suppressWarnings(nonmem2rx(system.file(x, package="nonmem2rx"), save=FALSE))), NA) }) }) }) diff --git a/tests/testthat/test-ddmore.R b/tests/testthat/test-ddmore.R index fe035fcb..e0421d1b 100644 --- a/tests/testthat/test-ddmore.R +++ b/tests/testthat/test-ddmore.R @@ -185,7 +185,7 @@ if (identical(Sys.getenv("NOT_CRAN"), "true")) { unzip(system.file("ddmore.zip", package="nonmem2rx")) lapply(files,function(x) { test_that(paste(x, ", extended"), { - expect_error(suppressMessages(suppressWarnings(nonmem2rx(x))), NA) + expect_error(suppressMessages(suppressWarnings(nonmem2rx(x, save=FALSE))), NA) }) }) }) diff --git a/tests/testthat/test-external-models.R b/tests/testthat/test-external-models.R index bd50cc35..4e7b8d23 100644 --- a/tests/testthat/test-external-models.R +++ b/tests/testthat/test-external-models.R @@ -1,5 +1,5 @@ -.nonmem2rx <- function(...) { - suppressWarnings(suppressMessages(nonmem2rx(...))) +.nonmem2rx <- function(..., save=FALSE) { + suppressWarnings(suppressMessages(nonmem2rx(..., save=FALSE))) } withr::with_options(list(nonmem2rx.save=FALSE, nonmem2rx.load=FALSE, nonmem2rx.overwrite=FALSE),{ diff --git a/tests/testthat/test-full-parsing.R b/tests/testthat/test-full-parsing.R index 408e3e99..619492ea 100644 --- a/tests/testthat/test-full-parsing.R +++ b/tests/testthat/test-full-parsing.R @@ -1,5 +1,5 @@ -.nonmem2rx <- function(...) { - suppressMessages(nonmem2rx(...)) +.nonmem2rx <- function(..., save=FALSE) { + suppressMessages(nonmem2rx(..., save=FALSE)) } withr::with_options(list(nonmem2rx.save=FALSE, nonmem2rx.load=FALSE, nonmem2rx.overwrite=FALSE, diff --git a/tests/testthat/test-linCmt.R b/tests/testthat/test-linCmt.R index 0d36ffbc..d54e7f5c 100644 --- a/tests/testthat/test-linCmt.R +++ b/tests/testthat/test-linCmt.R @@ -1,4 +1,4 @@ test_that("linCmt read test(s)", { skip_on_cran() - expect_error(nonmem2rx(system.file("mods/err/run000.lst", package="nonmem2rx")), NA) + expect_error(nonmem2rx(system.file("mods/err/run000.lst", package="nonmem2rx"), save=FALSE), NA) }) diff --git a/tests/testthat/test-model-load.R b/tests/testthat/test-model-load.R index bcb721e4..3547434b 100644 --- a/tests/testthat/test-model-load.R +++ b/tests/testthat/test-model-load.R @@ -1,5 +1,5 @@ -.nonmem2rx <- function(...) { - suppressWarnings(suppressMessages(nonmem2rx(...))) +.nonmem2rx <- function(..., save=FALSE) { + suppressWarnings(suppressMessages(nonmem2rx(..., save=FALSE))) } withr::with_options(list(nonmem2rx.save=FALSE, nonmem2rx.load=FALSE, nonmem2rx.overwrite=FALSE),{ diff --git a/tests/testthat/test-nm75.R b/tests/testthat/test-nm75.R index 63f12eb1..ee2c5d0b 100644 --- a/tests/testthat/test-nm75.R +++ b/tests/testthat/test-nm75.R @@ -1,5 +1,5 @@ -.nonmem2rx <- function(...) { - suppressWarnings(suppressMessages(nonmem2rx(...))) +.nonmem2rx <- function(..., save=FALSE) { + suppressWarnings(suppressMessages(nonmem2rx(..., save=FALSE))) } withr::with_options(list(nonmem2rx.save=FALSE, nonmem2rx.load=FALSE, nonmem2rx.overwrite=FALSE),{ diff --git a/tests/testthat/test-piping.R b/tests/testthat/test-piping.R index bc347eec..82e7b0b0 100644 --- a/tests/testthat/test-piping.R +++ b/tests/testthat/test-piping.R @@ -1,5 +1,5 @@ -.nonmem2rx <- function(...) { - suppressWarnings(suppressMessages(nonmem2rx(...))) +.nonmem2rx <- function(..., save=FALSE) { + suppressWarnings(suppressMessages(nonmem2rx(..., save=FALSE))) } withr::with_options(list(nonmem2rx.save=FALSE, nonmem2rx.load=FALSE, nonmem2rx.overwrite=FALSE),{ diff --git a/tests/testthat/test-psn.R b/tests/testthat/test-psn.R index ff2641fa..b4a8b83e 100644 --- a/tests/testthat/test-psn.R +++ b/tests/testthat/test-psn.R @@ -220,14 +220,14 @@ if (identical(Sys.getenv("NOT_CRAN"), "true")) { lapply(.files, function(file) { test_that(file, { - expect_error(suppressMessages(suppressWarnings(nonmem2rx(file, strictLst=TRUE))), NA) + expect_error(suppressMessages(suppressWarnings(nonmem2rx(file, strictLst=TRUE, save=FALSE))), NA) }) }) lapply(.fileError, function(file) { test_that(paste0("error for ", file), { - expect_error(suppressMessages(suppressWarnings(nonmem2rx(file, strictLst=TRUE)))) + expect_error(suppressMessages(suppressWarnings(nonmem2rx(file, strictLst=TRUE, save=FALSE)))) }) }) diff --git a/tests/testthat/test-read-nonmemData.R b/tests/testthat/test-read-nonmemData.R index 02543bfe..cfc425aa 100644 --- a/tests/testthat/test-read-nonmemData.R +++ b/tests/testthat/test-read-nonmemData.R @@ -8,17 +8,17 @@ withr::with_options(list(nonmem2rx.save=FALSE, nonmem2rx.load=FALSE, nonmem2rx.o file.copy(system.file("mods/cpt/Bolus_2CPT.csv", package="nonmem2rx"), file.path(getwd(), "Bolus_2CPT.csv")) - f <- nonmem2rx("runODE032.ctl") + f <- nonmem2rx("runODE032.ctl", save=FALSE) expect_true(is.null(f$nonmemData)) - f <- nonmem2rx("runODE032.ctl", nonmemData=TRUE) + f <- nonmem2rx("runODE032.ctl", nonmemData=TRUE, save=FALSE) expect_true(inherits(f$nonmemData, "data.frame")) }) }) test_that("read in data without phi, lower case id", { skip_on_cran() - expect_error(nonmem2rx(system.file("mods/err/run002.res", package="nonmem2rx"), lst=".res", usePhi = FALSE), NA) - tmp <- nonmem2rx(system.file("mods/err/run002.res", package="nonmem2rx"), lst=".res", usePhi = FALSE) + expect_error(nonmem2rx(system.file("mods/err/run002.res", package="nonmem2rx"), lst=".res", usePhi = FALSE, save=FALSE), NA) + tmp <- nonmem2rx(system.file("mods/err/run002.res", package="nonmem2rx"), lst=".res", usePhi = FALSE, save=FALSE) expect_true(inherits(tmp$iwresAtol, "numeric")) expect_true(length(tmp$iwresAtol) == 1L) }) diff --git a/tests/testthat/test-rename.R b/tests/testthat/test-rename.R index 1416dc51..651cef31 100644 --- a/tests/testthat/test-rename.R +++ b/tests/testthat/test-rename.R @@ -1,5 +1,5 @@ -.nonmem2rx <- function(...) { - suppressWarnings(suppressMessages(nonmem2rx(...))) +.nonmem2rx <- function(..., save=FALSE) { + suppressWarnings(suppressMessages(nonmem2rx(..., save=FALSE))) } withr::with_options(list(nonmem2rx.save=FALSE, nonmem2rx.load=FALSE, nonmem2rx.overwrite=FALSE),{ diff --git a/tests/testthat/test-rxsolve.R b/tests/testthat/test-rxsolve.R index 2fba3f54..97c2b075 100644 --- a/tests/testthat/test-rxsolve.R +++ b/tests/testthat/test-rxsolve.R @@ -1,5 +1,5 @@ -.nonmem2rx <- function(...) { - suppressWarnings(suppressMessages(nonmem2rx(...))) +.nonmem2rx <- function(..., save=FALSE) { + suppressWarnings(suppressMessages(nonmem2rx(..., save=FALSE))) } .rxSolve <- function(...) {