Skip to content

Commit

Permalink
v0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
philipdelff committed Jul 9, 2023
1 parent f6d6fdc commit d98e745
Show file tree
Hide file tree
Showing 22 changed files with 58 additions and 29 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: NMdata
Type: Package
Title: Preparation, Checking and Post-Processing Data for PK/PD Modeling
Version: 0.0.17.911
Version: 0.1.0
Authors@R: c(person("Philip", "Delff", email = "[email protected]", role = c("aut", "cre")))
Maintainer: Philip Delff <[email protected]>
Description: Efficient tools for preparation, checking and post-processing of data in PK/PD (pharmacokinetics/pharmacodynamics) modeling, with focus on use of Nonmem. Attention is paid to ensure consistency, traceability, and Nonmem compatibility of Data. Rigorously checks final Nonmem datasets. Implemented in 'data.table', but easily integrated with 'base' and 'tidyverse'.
Expand Down
2 changes: 2 additions & 0 deletions R/NMcheckData.R
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,13 @@
##' }
##' @return A table with findings
##' @examples
##' \dontrun{
##' dat <- readRDS(system.file("examples/data/xgxr2.rds", package="NMdata"))
##' NMcheckData(dat)
##' dat[EVID==0,LLOQ:=3.5]
##' ## expecting LLOQ only for samples
##' NMcheckData(dat,cols.num=list(c("STUDY"),"EVID==0"=c("LLOQ")))
##' }
##' @import data.table
##' @export

Expand Down
2 changes: 2 additions & 0 deletions R/NMscanData.R
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@
##' \item{NULL}{The NULL argument to specify missing value string in input data is not respected. If delimited input data is read (as opposed to rds files), missing values are assumed to be represented by dots (.).}
##' }
##' @examples
##' \dontrun{
##' res1 <- NMscanData(system.file("examples/nonmem/xgxr001.lst", package="NMdata"))
##' }
##' @return A data set of class 'NMdata'.
##' @family DataRead
##' @import data.table
Expand Down
4 changes: 3 additions & 1 deletion R/NMscanMultiple.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@
##' @param ... Additional arguments passed to NMscanData.
##' @return All results stacked, class as defined by as.fun
##' @examples
##' \dontrun{
##' res <- NMscanMultiple(dir=system.file("examples/nonmem", package="NMdata"),
##' file.pattern="xgxr01.*\\.lst",as.fun="data.table")
##' res.mean <- res[,.(meanPRED=exp(mean(log(PRED)))),by=.(model,NOMTIME)]
##' library(ggplot2)
##' ggplot(res.mean,aes(NOMTIME,meanPRED,colour=model))+geom_line()
##' ggplot(res.mean,aes(NOMTIME,meanPRED,colour=model))+geom_line()
##' }
##' @export


Expand Down
10 changes: 5 additions & 5 deletions R/NMwriteData.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@
##' Nonmem.
##' @param save Save defined files? Default is TRUE. If a variable is
##' used to control whether a script generates outputs (say
##' `writeOutputs=TRUE/FALSE`), if you use `save=writeOutputs` to
##' comply with this.
##' \code{writeOutputs=TRUE/FALSE)}, if you use
##' \code{save=writeOutputs} to comply with this.
##' @param args.NMgenText List of arguments to pass to NMgenText - the
##' function that generates text suggestion for INPUT and DATA
##' sections in the Nonmem control stream. You can use these
##' arguments to get a text suggestion you an use directly in
##' Nonmem - and NMwriteSection can even update multiple Nonmem
##' control streams based on the result. This will update your
##' control streams to match your new data file with just one
##' Nonmem - and \code{NMwriteSection} can even update multiple
##' Nonmem control streams based on the result. This will update
##' your control streams to match your new data file with just one
##' command.
##' @param csv.trunc.as.nm If TRUE, csv file will be truncated
##' horizontally (columns will be dropped) to match the $INPUT
Expand Down
2 changes: 2 additions & 0 deletions R/findCovs.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@
##' ## occasion level
##' findCovs(findVars(dt1,"ID"),c("ID","OCC"))
##' ## Based on a "real data example"
##' \dontrun{
##' dat <- NMscanData(system.file("examples/nonmem/xgxr001.lst", package = "NMdata"))
##' findCovs(dat,by="ID")
##' ### Without an ID column we get non-varying columns
##' findCovs(dat)
##' }
##' @export


Expand Down
2 changes: 2 additions & 0 deletions R/flagsAssign.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
##' @import data.table
##' @family DataCreate
##' @examples
##' \dontrun{
##' pk <- readRDS(file=system.file("examples/data/xgxr2.rds",package="NMdata"))
##' dt.flags <- data.frame(
##' flagn=10,
Expand All @@ -59,6 +60,7 @@
##' col.flagn="flagn",col.flagc="flagc")
##' unique(pk[,c("EVID","flagn","flagc","BLQ")])
##' flagsCount(pk[EVID==0],dt.flags,col.flagn="flagn",col.flagc="flagc")
##' }
##' @export


Expand Down
2 changes: 2 additions & 0 deletions R/flagsCount.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
##' @import data.table
##' @family DataCreate
##' @examples
##' \dontrun{
##' pk <- readRDS(file=system.file("examples/data/xgxr2.rds",package="NMdata"))
##' dt.flags <- data.frame(
##' flagn=10,
Expand All @@ -78,6 +79,7 @@
##' col.flagn="flagn",col.flagc="flagc")
##' unique(pk[,c("EVID","flagn","flagc","BLQ")])
##' flagsCount(pk[EVID==0],dt.flags,col.flagn="flagn",col.flagc="flagc")
##' }
##' @export


Expand Down
4 changes: 3 additions & 1 deletion R/lstExtractTime.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
##' NMdata:::lstExtractTime(file)
##' file <- system.file("examples/nonmem/xgxr003.mod",package="NMdata")
##' NMdata:::lstExtractTime(file)
##'
##'
##' \dontrun{
##' all.lsts <- list.files(
##' system.file("examples/nonmem",package="NMdata"),
##' pattern="\\.lst",full.names=TRUE)
##' lapply(all.lsts,NMdata:::lstExtractTime)
##' }
##' @keywords internal

lstExtractTime <- function(file,tz.lst="as.is"){
Expand Down
2 changes: 1 addition & 1 deletion R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ NMdataConf(reset=TRUE)

##' @importFrom utils packageVersion
.onAttach <- function(libname,pkgname){
packageStartupMessage(paste0("This is NMdata ",packageVersion("NMdata"),". Browse NMdata documentation at\nhttps://philipdelff.github.io/NMdata/"))
packageStartupMessage(paste0("NMdata ",packageVersion("NMdata"),". Browse NMdata documentation at\nhttps://philipdelff.github.io/NMdata/"))
}
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ the
<a href="https://htmlpreview.github.io/?https://github.com/philipdelff/NMdata/blob/master/vignettes/NMdata-cheat.html"><img src="man/figures/cheatsheet_icon_0010.png" alt="CheatSheet" width="200"/></a>

### How to install
`NMdata` is on [CRAN](https://cran.r-project.org/), [MRAN](https://mran.microsoft.com/), and [MPN](https://mpn.metworx.com). To install from the package archive you are already using, do:
`NMdata` is on [CRAN](https://cran.r-project.org/package=NMdata) and [MPN](https://mpn.metworx.com/docs/packages/NMdata). To install from the package archive you are already using, do:

```
install.packages("NMdata")
Expand Down
27 changes: 14 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,15 @@ the
[Cheatsheet](https://htmlpreview.github.io/?https://github.com/philipdelff/NMdata/blob/master/vignettes/NMdata-cheat.html).

<!-- ![Cheatsheet](man/figures/cheatsheet_icon_0010.png){width="15%"} -->

<!-- [Cheatsheet](https://htmlpreview.github.io/?https://github.com/philipdelff/NMdata/blob/master/devel/NMdata-cheat.html) -->

<a href="https://htmlpreview.github.io/?https://github.com/philipdelff/NMdata/blob/master/vignettes/NMdata-cheat.html"><img src="man/figures/cheatsheet_icon_0010.png" alt="CheatSheet" width="200"/></a>

### How to install

`NMdata` is on [CRAN](https://cran.r-project.org/),
[MRAN](https://mran.microsoft.com/), and [MPN](https://mpn.metworx.com).
To install from the package archive you are already using, do:
`NMdata` is on [CRAN](https://cran.r-project.org/package=NMdata) and
[MPN](https://mpn.metworx.com/docs/packages/NMdata). To install from the
package archive you are already using, do:

install.packages("NMdata")
library(NMdata)
Expand Down Expand Up @@ -120,7 +119,7 @@ ggplot(res.plot,aes(TIME))+
labs(y="Concentration (unit)",colour="Observations",
subtitle="NOTICE:\nObservations are coloured by a character column fetched from input data.\nSamples below LLOQ are rows added from input data.\nPlots are correctly sorted because factor levels of dose are preserved from input data.")+
theme_bw()+theme(legend.position="bottom")
#> Warning: Removed 2 row(s) containing missing values (geom_path).
#> Warning: Removed 2 rows containing missing values (`geom_line()`).
```

<img src="man/figures/README-NMscanData-example1-plot-1.png" width="100%" />
Expand Down Expand Up @@ -156,15 +155,17 @@ read multiple models and compare their predictions.
``` r
res <- NMscanMultiple(dir=system.file("examples/nonmem", package="NMdata"),
file.pattern="xgxr.*\\.lst",as.fun="data.table",quiet=TRUE)
#> No missing values identified
#> Input and output data were searched for candidate unique row identifiers. None
#> found. To skip this check, please use merge.by.row=TRUE or merge.by.row=FALSE.
#>
#>
#> Overview of model scanning results:
#> lst
#> 1: /tmp/RtmpTd9QIu/temp_libpath102521020f9b7/NMdata/examples/nonmem/xgxr001.lst
#> 2: /tmp/RtmpTd9QIu/temp_libpath102521020f9b7/NMdata/examples/nonmem/xgxr002.lst
#> 3: /tmp/RtmpTd9QIu/temp_libpath102521020f9b7/NMdata/examples/nonmem/xgxr003.lst
#> 4: /tmp/RtmpTd9QIu/temp_libpath102521020f9b7/NMdata/examples/nonmem/xgxr014.lst
#> 5: /tmp/RtmpTd9QIu/temp_libpath102521020f9b7/NMdata/examples/nonmem/xgxr018.lst
#> lst
#> 1: /tmp/Rtmp82nZom/temp_libpath1370126d22f6/NMdata/examples/nonmem/xgxr001.lst
#> 2: /tmp/Rtmp82nZom/temp_libpath1370126d22f6/NMdata/examples/nonmem/xgxr002.lst
#> 3: /tmp/Rtmp82nZom/temp_libpath1370126d22f6/NMdata/examples/nonmem/xgxr003.lst
#> 4: /tmp/Rtmp82nZom/temp_libpath1370126d22f6/NMdata/examples/nonmem/xgxr014.lst
#> 5: /tmp/Rtmp82nZom/temp_libpath1370126d22f6/NMdata/examples/nonmem/xgxr018.lst
#> nrows ncols success warning
#> 1: 905 40 TRUE FALSE
#> 2: 905 34 TRUE FALSE
Expand Down Expand Up @@ -195,7 +196,7 @@ reached CRAN, installing from Github is easy too.
## Option 2: Install explicitly from CRAN
install.packages("NMdata",repos="https://cloud.r-project.org")
library(NMdata)

## Option 3: Install from github
library(remotes)
install_github("philipdelff/NMdata")
Expand Down
2 changes: 2 additions & 0 deletions man/NMcheckData.Rd

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

2 changes: 2 additions & 0 deletions man/NMscanData.Rd

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

4 changes: 3 additions & 1 deletion man/NMscanMultiple.Rd

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

10 changes: 5 additions & 5 deletions man/NMwriteData.Rd

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

Binary file modified man/figures/README-NMscanData-example1-plot-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-unnamed-chunk-2-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions man/findCovs.Rd

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

2 changes: 2 additions & 0 deletions man/flagsAssign.Rd

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

2 changes: 2 additions & 0 deletions man/flagsCount.Rd

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

2 changes: 2 additions & 0 deletions man/lstExtractTime.Rd

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

0 comments on commit d98e745

Please sign in to comment.