Skip to content

Commit

Permalink
cleaning test data
Browse files Browse the repository at this point in the history
  • Loading branch information
philipdelff committed Aug 26, 2024
1 parent d95f845 commit 5a556d4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions tests/testthat/test_NMorderColumns.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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")]
Expand Down
7 changes: 4 additions & 3 deletions tests/testthat/test_NMwriteData.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")]

Expand All @@ -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
Expand Down Expand Up @@ -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")]
Expand Down

0 comments on commit 5a556d4

Please sign in to comment.