diff --git a/R/NMcheckData.R b/R/NMcheckData.R index 14db4b19..98a08537 100644 --- a/R/NMcheckData.R +++ b/R/NMcheckData.R @@ -110,7 +110,7 @@ ##' ##' \item col.time (TIME) must be non-negative ##' -##' \item EVID must be in {0,1,2,3,4}. +##' \item EVID must be in \{0,1,2,3,4\}. ##' ##' \item CMT must be positive integers. However, can be missing or zero for EVID==3. ##' @@ -123,7 +123,7 @@ ##' ##' \item DV must be numeric ##' -##' \item DV must be missing for EVID in {1,4}. +##' \item DV must be missing for EVID in \{1,4\}. ##' ##' \item If found, RATE must be a numeric, equaling -2 or non-negative for dosing events. ##' @@ -141,9 +141,9 @@ ##' error. Use a second ID column if you deliberately want to ##' soften this check) ##' -##' \item TIME cannot be decreasing within ID, unless EVID in {3,4}. +##' \item TIME cannot be decreasing within ID, unless EVID in \{3,4\}. ##' -##' \item all ID's must have doses (EVID in {1,4}) +##' \item all ID's must have doses (EVID in \{1,4\}) ##' ##' \item all ID's must have observations (EVID==0) ##' diff --git a/R/NMorderColumns.R b/R/NMorderColumns.R index d55c72a3..54478b6b 100644 --- a/R/NMorderColumns.R +++ b/R/NMorderColumns.R @@ -56,7 +56,7 @@ ##' following steps, each step depending on corresponding ##' argument. ##' -##' \itemize{ +##' \describe{ ##' \item{"col.row - "}{Row id if argument row is non-NULL} ##' \item{"not editable - "}{ID (if a column is called ID)} ##' \item{"col.nomtime - "}{Nominal time.} diff --git a/R/NMreadCsv.R b/R/NMreadCsv.R index e4cf26b8..3f64aedb 100644 --- a/R/NMreadCsv.R +++ b/R/NMreadCsv.R @@ -21,7 +21,7 @@ ##' format is used, the extension can very well be different from ##' "csv" (say file name is ##' "input.tab")". This will work for any delimited format supported by fread. -##' @param args.fst Optional arguments to pass to \code{read_fst} if code{format="fst"} is used. +##' @param args.fst Optional arguments to pass to \code{read_fst} if \code{format="fst"} is used. ##' @details This is almost just a shortcut to fread so you don't have to remember how to read the data that was exported for Nonmem. The only added feature is that meta data as written by NMwriteData is read and attached as NMdata metadata before data is returned. ##' @return A data set of class as defined by as.fun. ##' @importFrom data.table fread diff --git a/R/NMscanData.R b/R/NMscanData.R index f952508a..5ff2469c 100644 --- a/R/NMscanData.R +++ b/R/NMscanData.R @@ -6,7 +6,8 @@ ##' \item{Read and combine output tables,} ##' \item{If wanted, read input data and restore variables that were not output from the Nonmem model} ##' \item{If wanted, also restore rows from input data that were disregarded in -##' Nonmem (e.g. observations or subjects that are not part of the analysis)} +##' Nonmem (e.g. observations or subjects that are not part of the analysis) +##' } ##' } ##' ##' @param file Path to a Nonmem control stream or output file from @@ -293,7 +294,7 @@ NMscanData <- function(file, col.row, use.input, merge.by.row, ## For now, searching for a row identifier is disabled. This may belong in a separate function. search.col.row <- FALSE ### notice, this can't be evaluated if merge.by.row=="ifAvailable" - if(is.null(merge.by.row.arg) && is.character(merge.by.row) && merge.by.row=="ifAvailable"){ + if(!quiet && is.null(merge.by.row.arg) && is.character(merge.by.row) && merge.by.row=="ifAvailable"){ search.col.row <- TRUE } diff --git a/man/NMcheckData.Rd b/man/NMcheckData.Rd index 60a82a69..4f69c7b6 100644 --- a/man/NMcheckData.Rd +++ b/man/NMcheckData.Rd @@ -163,7 +163,7 @@ non-missing, increasing integers. \item col.time (TIME) must be non-negative -\item EVID must be in {0,1,2,3,4} +\item EVID must be in \{0,1,2,3,4\}. \item CMT must be positive integers. However, can be missing or zero for EVID==3. @@ -176,7 +176,7 @@ dosing records (EVID==0). \item DV must be numeric -\item DV must be missing for EVID in {1,4}. +\item DV must be missing for EVID in \{1,4\}. \item If found, RATE must be a numeric, equaling -2 or non-negative for dosing events. @@ -194,9 +194,9 @@ records. \code{ADDL} must be present. error. Use a second ID column if you deliberately want to soften this check) -\item TIME cannot be decreasing within ID, unless EVID in {3,4}. +\item TIME cannot be decreasing within ID, unless EVID in \{3,4\}. -\item all ID's must have doses (EVID in {1,4}) +\item all ID's must have doses (EVID in \{1,4\}) \item all ID's must have observations (EVID==0) diff --git a/man/NMorderColumns.Rd b/man/NMorderColumns.Rd index 66ef57a1..b995a04c 100644 --- a/man/NMorderColumns.Rd +++ b/man/NMorderColumns.Rd @@ -95,7 +95,7 @@ This function will change the order of columns but it following steps, each step depending on corresponding argument. -\itemize{ +\describe{ \item{"col.row - "}{Row id if argument row is non-NULL} \item{"not editable - "}{ID (if a column is called ID)} \item{"col.nomtime - "}{Nominal time.} diff --git a/man/NMreadCsv.Rd b/man/NMreadCsv.Rd index aaec1361..27528f76 100644 --- a/man/NMreadCsv.Rd +++ b/man/NMreadCsv.Rd @@ -35,7 +35,7 @@ format is used, the extension can very well be different from "csv" (say file name is "input.tab")". This will work for any delimited format supported by fread.} -\item{args.fst}{Optional arguments to pass to \code{read_fst} if code{format="fst"} is used.} +\item{args.fst}{Optional arguments to pass to \code{read_fst} if \code{format="fst"} is used.} } \value{ A data set of class as defined by as.fun. diff --git a/man/NMscanData.Rd b/man/NMscanData.Rd index 5bb94917..823e2be3 100644 --- a/man/NMscanData.Rd +++ b/man/NMscanData.Rd @@ -182,7 +182,8 @@ steps are \item{Read and combine output tables,} \item{If wanted, read input data and restore variables that were not output from the Nonmem model} \item{If wanted, also restore rows from input data that were disregarded in -Nonmem (e.g. observations or subjects that are not part of the analysis)} +Nonmem (e.g. observations or subjects that are not part of the analysis) +} } } \details{ diff --git a/tests/testthat/testReference/NMscanData1_bu.rds b/tests/testthat/testReference/NMscanData1_bu.rds deleted file mode 100644 index 52966807..00000000 Binary files a/tests/testthat/testReference/NMscanData1_bu.rds and /dev/null differ diff --git a/tests/testthat/testReference/NMscanData21.rds b/tests/testthat/testReference/NMscanData21.rds deleted file mode 100644 index ba0e5c65..00000000 Binary files a/tests/testthat/testReference/NMscanData21.rds and /dev/null differ diff --git a/tests/testthat/testReference/NMscanData_21.rds b/tests/testthat/testReference/NMscanData_21.rds new file mode 100644 index 00000000..2ef9730b Binary files /dev/null and b/tests/testthat/testReference/NMscanData_21.rds differ diff --git a/tests/testthat/testReference/NMscanData_22b.rds b/tests/testthat/testReference/NMscanData_22b.rds index abc8cbb0..fde3ddde 100644 Binary files a/tests/testthat/testReference/NMscanData_22b.rds and b/tests/testthat/testReference/NMscanData_22b.rds differ diff --git a/tests/testthat/testReference/NMscanMultiple1.rds b/tests/testthat/testReference/NMscanMultiple1.rds deleted file mode 100644 index 1ff7e173..00000000 Binary files a/tests/testthat/testReference/NMscanMultiple1.rds and /dev/null differ diff --git a/tests/testthat/testReference/NMscanMultiple_01.rds b/tests/testthat/testReference/NMscanMultiple_01.rds new file mode 100644 index 00000000..e1dd05f5 Binary files /dev/null and b/tests/testthat/testReference/NMscanMultiple_01.rds differ diff --git a/tests/testthat/test_NMscanData.R b/tests/testthat/test_NMscanData.R index 2f0eb216..743a4c04 100644 --- a/tests/testthat/test_NMscanData.R +++ b/tests/testthat/test_NMscanData.R @@ -616,7 +616,7 @@ test_that("Modifying row identifier",{ test_that("merge.by.row=ifAvailable when available",{ NMdataConf(reset=TRUE) - fileRef <- "testReference/NMscanData21.rds" + fileRef <- "testReference/NMscanData_21.rds" file.lst <- system.file("examples/nonmem/xgxr001.lst" ,package="NMdata") diff --git a/tests/testthat/test_NMscanMultiple.R b/tests/testthat/test_NMscanMultiple.R index a08fad90..a07b6dce 100644 --- a/tests/testthat/test_NMscanMultiple.R +++ b/tests/testthat/test_NMscanMultiple.R @@ -28,17 +28,25 @@ fix.time <- function(x){ invisible(x) } + + NMdataConf(reset=TRUE) test_that("basic",{ - fileRef <- "testReference/NMscanMultiple1.rds" + fileRef <- "testReference/NMscanMultiple_01.rds" resRef <- if(file.exists(fileRef)) readRDS(fileRef) else NULL - - res <- NMscanMultiple(dir=system.file("examples/nonmem",package="NMdata"),file.pattern="xgxr.*\\.lst", check.time = FALSE,quiet=TRUE) + +### we do this in two steps because not all systems will find the files in same order apparently + lsts <- list.files(path="testData/nonmem/",pattern="xgxr00[1-9]\\.lst",full.names=TRUE) + lsts <- sort(lsts) + res <- NMscanMultiple(lsts, check.time = FALSE,quiet=TRUE) ## dim(res) - res <- lapply(res,fix.time) - + ## res <- lapply(res,fix.time) + res <- as.data.frame(res) + unNMdata(res) + ## res[,.N,by=.(model)] + expect_equal_to_reference(res,fileRef,version=2) ## without meta ## expect_equal(unNMdata(res1),unNMdata(readRDS(fileRef)))