Skip to content

Commit

Permalink
Add dvid->cmt translation
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfidler committed May 15, 2023
1 parent 8768531 commit f714f69
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions R/asNonmem2rx.R
Expand Up @@ -70,9 +70,18 @@ as.nonmem2rx <- function(model1, model2, compress=TRUE) {
.nonmemData <- .rx$nonmemData
.w <- which(names(.nonmemData) == "nmdvid")
if (length(.w) == 1L) {
.minfo("assuming 'dvid' is close enough to nlmixr2 definition")
names(.nonmemData)[.w] <- "dvid"
.rx$nonmemData <- .nonmemData
.wcmt <- which(tolower(names(.nonmemData)) == "cmt")
.wevid <- which(tolower(names(.nonmemData)) == "evid")
if (length(.wcmt) == 1L && length(.wevid) == 1L) {
.minfo("merging 'dvid' with nlmixr2 'cmt' definition")
.nonmemData[,.wcmt] <- ifelse(.nonmemData[, .wevid] != 0, .nonmemData[,.wcmt],
length(.ui$mv0$state) + .nonmemData[, .w])
.rx$nonmemData <- .nonmemData
} else {
.minfo("assuming 'dvid' is close enough to nlmixr2 definition")
names(.nonmemData)[.w] <- "dvid"
}

}
# now rename thetaMat
.iniDfIn <- .nm2rx$iniDf
Expand Down

0 comments on commit f714f69

Please sign in to comment.