diff --git a/NEWS.md b/NEWS.md index f8d77e73..56ae61a7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -29,7 +29,9 @@ (`NMorderColumn()`) and the auto-generated `$INPUT` section suggestions. Where applicable, the `allow.char.TIME` argument controls this behavior. Set to `allow.char.TIME=FALSE` to require - `TIME` and `DATE` columns be numeric. + `TIME` and `DATE` columns be numeric. Thanks to Sanaya Shroff for + the request, enabling `NMsim` to simulate using data sets with one + or more of these columns coded as character. * `mergeCheck(x,y)` has new options for handling common columns in data sets. The `common.cols` argument replaces `fun.commoncols` with diff --git a/tests/testthat/test_NMorderColumns.R b/tests/testthat/test_NMorderColumns.R index 0a15265b..b6dbae5d 100644 --- a/tests/testthat/test_NMorderColumns.R +++ b/tests/testthat/test_NMorderColumns.R @@ -5,7 +5,7 @@ test_that("last NULL",{ fileRef <- "testReference/NMorderColumns_01.rds" ## pk <- readRDS(file=system.file("examples/data/xgxr2.rds",package="NMdata")) - pk <- readRDS(file="testData/data/xgxr2.rds") + pk <- readRDS(file="testData/data/xgxr2.rds")|> setDT() pk1 <- NMorderColumns(pk) pk2 <- NMorderColumns(pk,last=c("FLAG",NULL)) @@ -26,8 +26,7 @@ test_that("Non-numeric DATE and TIME",{ fileRef <- "testReference/NMorderColumns_02.rds" -## pk <- readRDS(file=system.file("examples/data/xgxr2.rds",package="NMdata")) - pk <- readRDS(file="testData/data/xgxr2.rds") + pk <- readRDS(file="testData/data/xgxr2.rds") |> setDT() pk[,time.tz:=as.POSIXct("2000/01/01")+TIME*3600] pk[,DATE:=as.character(as.Date(time.tz),format="%y/%m/%d")] diff --git a/tests/testthat/test_NMwriteData.R b/tests/testthat/test_NMwriteData.R index 41e8ee89..e2b36b45 100644 --- a/tests/testthat/test_NMwriteData.R +++ b/tests/testthat/test_NMwriteData.R @@ -79,7 +79,8 @@ test_that("Dropping a column in Nonmem",{ test_that("A comma in a character",{ - pk <- readRDS(file=system.file("examples/data/xgxr2.rds",package="NMdata")) + ## pk <- readRDS(file=system.file("examples/data/xgxr2.rds",package="NMdata")) + pk <- readRDS(file="testData/data/xgxr2.rds") |> setDT() ## dropping a character column pk[,CYCLE:=paste0(as.character(CYCLE),",0")] @@ -96,7 +97,7 @@ test_that("A comma in a character",{ test_that("Identical column names",{ - pk <- readRDS(file=system.file("examples/data/xgxr2.rds",package="NMdata")) + pk <- readRDS(file="testData/data/xgxr2.rds") |> setDT() pk <- cbind(pk[,.(CYCLE)],pk) expect_warning(NMwriteData(pk,file="testOutput/NMwriteDataTmp.csv" ,write.rds=F,write.csv=F @@ -309,7 +310,7 @@ test_that("Non-numeric DATE and TIME",{ fileRef <- "testReference/NMwriteData_13.rds" outfile <- "testOutput/NMwriteData_13.csv" - pk <- readRDS(file=system.file("examples/data/xgxr2.rds",package="NMdata")) + pk <- readRDS(file="testData/data/xgxr2.rds") |> setDT() pk[,time.tz:=as.POSIXct("2000/01/01")+TIME*3600] pk[,DATE:=as.character(as.Date(time.tz),format="%y/%m/%d")]