NMscanMultiple: Run NMscanData on multiple models and stack results

View source: R/NMscanMultiple.R

NMscanMultipleR Documentation

Run NMscanData on multiple models and stack results

Description

Useful function for meta analyses when multiple models are stored in one folder and can be read with NMscanData using the same arguments.

Usage

NMscanMultiple(files, dir, file.pattern, as.fun, ...)

Arguments

files

File paths to the models (control stream) to edit. See file.pattern too.

dir

The directory in which to find the models. Passed to list.files(). See file.pattern argument too.

file.pattern

The pattern used to match the filenames to read with NMscanData. Passed to list.files(). If dir is supplied and files is not (or is NULL), the default is ".*\.lst" which means all files ending in '.lst'. See dir argument too.

as.fun

The default is to return data as a data.frame. Pass a function (say tibble::as_tibble) in as.fun to convert to something else. If data.tables are wanted, use as.fun="data.table". The default can be configured using NMdataConf.

...

Additional arguments passed to NMscanData.

Value

All results stacked, class as defined by as.fun

Examples

## Not run: 
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()

## End(Not run)

NMdata documentation built on Nov. 11, 2023, 5:07 p.m.