Skip to content

Commit

Permalink
Address CRAN comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfidler committed May 26, 2023
1 parent fd222f8 commit b83b678
Show file tree
Hide file tree
Showing 20 changed files with 50 additions and 32 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@
^docs$
^pkgdown$
^cran-comments\.md$
^CRAN-SUBMISSION$
7 changes: 4 additions & 3 deletions R/nonmem2rx.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
#'
Expand Down
1 change: 1 addition & 0 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 3 additions & 0 deletions man/autoplot.nonmem2rx.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions man/nonmem2rx.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions tests/testthat/test-abbrev.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-bauer-2019.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
})
})
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-bauer-2021.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
})
})
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-ddmore.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
})
})
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-external-models.R
Original file line number Diff line number Diff line change
@@ -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),{
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-full-parsing.R
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-linCmt.R
Original file line number Diff line number Diff line change
@@ -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)
})
4 changes: 2 additions & 2 deletions tests/testthat/test-model-load.R
Original file line number Diff line number Diff line change
@@ -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),{
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-nm75.R
Original file line number Diff line number Diff line change
@@ -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),{
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-piping.R
Original file line number Diff line number Diff line change
@@ -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),{
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-psn.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))))
})
})

Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test-read-nonmemData.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-rename.R
Original file line number Diff line number Diff line change
@@ -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),{
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-rxsolve.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.nonmem2rx <- function(...) {
suppressWarnings(suppressMessages(nonmem2rx(...)))
.nonmem2rx <- function(..., save=FALSE) {
suppressWarnings(suppressMessages(nonmem2rx(..., save=FALSE)))
}

.rxSolve <- function(...) {
Expand Down

0 comments on commit b83b678

Please sign in to comment.