Overview

Description

Write data contained in a list of dataframes in a single file (NONMEM/Monolix format) or in several files as tables.

Usage

Arguments

r
a list of dataframes
result.file
a string with the name of the file
result.folder
a string with the name of the folder
sep
(default = “,”)
ext
a string with the extension of the file names
digits
(default = 5)
app.file
TRUE/FALSE (default=FALSE) append to file
app.dir
TRUE/FALSE (default=FALSE) append to dir


Writing simulated data

Single output

## [INFO] The lixoftConnectors package has been successfully initialized:
## lixoftConnectors package version -> 2019.1
## Lixoft softwares suite version   -> 2019R1

Use writeDatamlx to write the results of the simulation in a csv file using the standard format used by Monolix,

##   id time       y amount
## 1  1    0       .    100
## 2  1    5 5.75182      .
## 3  1   10 3.50217      .
## 4  1   15 2.05825      .
## 5  1   20 1.43786      .
## 6  1   24       .    100

in a txt file,

##   id time       y amount
## 1  1    0       .    100
## 2  1    5 5.75182      .
## 3  1   10 3.50217      .
## 4  1   15 2.05825      .
## 5  1   20 1.43786      .
## 6  1   24       .    100

or in several files in a folder

## [1] "treatment.csv" "y1.csv"

Data can be written both in a single file and in separated files in a folder

Remark: instead of using writeDatamlx, it is possible to ask simulx to write the results of the simulation in a file and/or in a folder.

##   time      y amount
## 1    0      .    100
## 2    5 5.7518      .
## 3   10 3.5022      .
## 4   15 2.0583      .
## 5   20 1.4379      .
## 6   24      .    100
## [1] "treatment.csv" "y1.csv"


Groups and replicates

A column group and a column rep are added to the data file when several groups and several replicates are defined

##   rep id group time        y amount
## 1   1  1     1    0        .    100
## 2   1  1     1    5  6.29267      .
## 3   1  1     1   10  4.09372      .
## 4   1  1     1   12        .    100
## 5   1  1     1   15 10.45882      .
## 6   1  1     1   20  6.08368      .


Censored data

A column cens and a column limit are added when (left/right/interval) censored data are simulated

##   id time       y cens limit amount
## 1  1    0       .    .     .    100
## 2  1    5 6.54725    0     .      .
## 3  1   10 3.67595    0     .      .
## 4  1   15       3    1     0      .
## 5  1   20       3    1     0      .
## 6  1   24       .    .     .    100


Using a Monolix project

Using a simplified format

Let us simulate some data using a Monolix project,

We can then write the results in a data file. Using writeDatamlx(..., result.file=...), information about the project is not used,

##   id time       y amount
## 1  1 0.00       .    320
## 2  1 0.25 3.22263      .
## 3  1 0.57 5.76049      .
## 4  1 1.12 7.02616      .
## 5  1 2.02 8.06874      .
## 6  1 3.82 6.80563      .

Information about the project can be used by defining the Monolix project as an input argument of writeDatamlx. In this case, a file with the simulated data is created in the result folder, with the prefix “sim_” added to the name of the original data file,

##   ID AMT AMT.KG TIME    CONC WEIGHT SEX
## 1  1 320   4.02 0.00       .   79.6   M
## 2  1   .      . 0.25 3.22263   79.6   M
## 3  1   .      . 0.57 5.76049   79.6   M
## 4  1   .      . 1.12 7.02616   79.6   M
## 5  1   .      . 2.02 8.06874   79.6   M
## 6  1   .      . 3.82 6.80563   79.6   M

Another file name can be used

##   ID AMT AMT.KG TIME    CONC WEIGHT SEX
## 1  1 320   4.02 0.00       .   79.6   M
## 2  1   .      . 0.25 3.22263   79.6   M
## 3  1   .      . 0.57 5.76049   79.6   M
## 4  1   .      . 1.12 7.02616   79.6   M
## 5  1   .      . 2.02 8.06874   79.6   M
## 6  1   .      . 3.82 6.80563   79.6   M

Writing the results in several files

The results can also be saved in separated files in a folder

## [1] "originalId.csv" "treatment.csv"  "y.csv"

Using the original format of the data

Note that the original format can be used by setting format.original=TRUE in the settings of simulx:

##   ID AMT AMT.KG TIME   CONC WEIGHT SEX
## 1  1 320   4.02 0.00      .   79.6   M
## 2  1   .      . 0.25 3.8611   79.6   M
## 3  1   .      . 0.57 7.1748   79.6   M
## 4  1   .      . 1.12 7.2208   79.6   M
## 5  1   .      . 2.02 8.8076   79.6   M
## 6  1   .      . 3.82 8.1912   79.6   M