Overview

Description

Read data in a Monolix/NONMEM format. Either the path to the data file or a Monolix project that uses this data file can be provided as input.

Usage

readDatamlx(data=NULL, project=NULL)

Arguments

project
a Monolix project
data
a formatted data file
addl.ss
number of additional doses to use for steady-state (default=10)

Value

A list of data frames.


Reading a data file

Let us read the warfarin PK data file in a Monolix format:

head(read.csv('data/warfarinPK.csv'))
##   id time   y amount   wt age sex
## 1  1    0   .    100 66.7  50   1
## 2  1   24 9.2      . 66.7  50   1
## 3  1   36 8.5      . 66.7  50   1
## 4  1   48 6.4      . 66.7  50   1
## 5  1   72 4.8      . 66.7  50   1
## 6  1   96 3.1      . 66.7  50   1

Information about the data file should be stored in a list:

warfarinPK <- list(
  dataFile = "data/warfarinPK.csv",
  headerTypes = c("id", "time", "observation", "amount", "contcov", "contcov", "catcov"),
  administration = "oral")

In this example, wt and age are continuous covariates while sex is categorical.

Old (<= 2016) and new (>=2018) header types are allowed.

readDatamlx(data) reads a Monolix data file and create several data frames.

warf.data <- readDatamlx(data=warfarinPK)

names(warf.data)
## [1] "treatment" "y"         "covariate" "id"        "N"         "catNames"
head(warf.data$treatment)
##   id time amount
## 1  1    0    100
## 2  2    0    100
## 3  3    0    120
## 4  4    0     60
## 5  5    0    113
## 6  6    0     90
head(warf.data$covariate)
##   id   wt age sex
## 1  1 66.7  50   1
## 2  2 66.7  31   1
## 3  3 80.0  40   1
## 4  4 40.0  46   0
## 5  5 75.3  43   1
## 6  6 60.0  36   0
head(warf.data$y)
##   id time   y
## 1  1   24 9.2
## 2  1   36 8.5
## 3  1   48 6.4
## 4  1   72 4.8
## 5  1   96 3.1
## 6  1  120 2.5


Reading a Monolix project

If a Monolix project has been already created using the data file, it can be used for reading the data

warf.data  <- readDatamlx(project="projects/warfarinPK.mlxtran")

An additional field data that can be used by Rsmlx is then returned

names(warf.data)
## [1] "treatment" "y"         "covariate" "id"        "N"         "catNames"
warf.data$data
## NULL