Package 'campsismod'

Title: Generic Implementation of a PK/PD Model
Description: A generic, easy-to-use and expandable implementation of a pharmacokinetic (PK) / pharmacodynamic (PD) model based on the S4 class system. This package allows the user to read/write a pharmacometric model from/to files and adapt it further on the fly in the R environment. For this purpose, this package provides an intuitive API to add, modify or delete equations, ordinary differential equations (ODE's), model parameters or compartment properties (like infusion duration or rate, bioavailability and initial values). Finally, this package also provides a useful export of the model for use with simulation packages 'rxode2' and 'mrgsolve'. This package is designed and intended to be used with package 'campsis', a PK/PD simulation platform built on top of 'rxode2' and 'mrgsolve'.
Authors: Nicolas Luyckx [aut, cre]
Maintainer: Nicolas Luyckx <[email protected]>
License: GPL (>= 3)
Version: 1.1.2
Built: 2024-11-26 11:44:25 UTC
Source: CRAN

Help Index


Add element to list.

Description

Add element to list.

Usage

add(object, x, ...)

## S4 method for signature 'pmx_list,pmx_element'
add(object, x, pos = NULL)

## S4 method for signature 'pmx_list,pmx_list'
add(object, x)

## S4 method for signature 'pmx_list,list'
add(object, x)

## S4 method for signature 'compartments,compartment_property'
add(object, x)

## S4 method for signature 'compartments,compartments'
add(object, x)

## S4 method for signature 'parameters,single_array_parameter'
add(object, x)

## S4 method for signature 'parameters,double_array_parameter'
add(object, x)

## S4 method for signature 'parameters,parameters'
add(object, x)

## S4 method for signature 'code_record,model_statement'
add(object, x, pos = NULL)

## S4 method for signature 'code_record,code_record'
add(object, x)

## S4 method for signature 'code_records,code_records'
add(object, x)

## S4 method for signature 'code_records,model_statement'
add(object, x, pos = NULL)

## S4 method for signature 'campsis_model,compartment_property'
add(object, x)

## S4 method for signature 'campsis_model,parameter'
add(object, x)

## S4 method for signature 'campsis_model,code_record'
add(object, x)

## S4 method for signature 'campsis_model,model_statement'
add(object, x, pos = NULL)

## S4 method for signature 'campsis_model,campsis_model'
add(object, x)

Arguments

object

list object

x

element to add

...

extra arguments, unused by this generic list

pos

position where x needs to be added in list

Value

modified list object


Generic function to add a suffix to various objects like parameters, code records, compartment names or a model (all previous objects at the same time). This makes it an extremely powerful function to combine 2 models or more (using function 'add'), that have similar equation, parameter or compartment names.

Description

Generic function to add a suffix to various objects like parameters, code records, compartment names or a model (all previous objects at the same time). This makes it an extremely powerful function to combine 2 models or more (using function 'add'), that have similar equation, parameter or compartment names.

Usage

addSuffix(object, suffix, separator = NULL, ...)

## S4 method for signature 'parameters,character,character'
addSuffix(object, suffix, separator = NULL, ...)

## S4 method for signature 'code_records,character,character'
addSuffix(object, suffix, separator = NULL, ...)

## S4 method for signature 'code_record,character,character'
addSuffix(object, suffix, separator = NULL, ...)

## S4 method for signature 'compartments,character,character'
addSuffix(object, suffix, separator = NULL, ...)

## S4 method for signature 'campsis_model,character,character'
addSuffix(object, suffix, separator = NULL, ...)

Arguments

object

generic object

suffix

suffix to be appended, single character value

separator

separator to use before the suffix, default is the underscore

...

extra arguments like 'model' if the changes need to be reflected in the model

Value

updated object of the same class as the provided object, unless 'model' was specified, in that case the model is returned


As data frame method.

Description

As data frame method.

Usage

as.data.frame(x, row.names = NULL, optional = FALSE, ...)

## S4 method for signature 'theta,character,logical'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)

## S4 method for signature 'omega,character,logical'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)

## S4 method for signature 'sigma,character,logical'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)

Arguments

x

generic object

row.names

row names

optional

optional

...

extra arguments

Value

data frame


Assert the given character vector is a single character string.

Description

Assert the given character vector is a single character string.

Usage

assertSingleCharacterString(x)

Arguments

x

single character string

Value

no return value


Auto-detect special variables from NONMEM as compartment properties. Bioavailabilities, infusion durations/rates and lag times will be automatically detected.

Description

Auto-detect special variables from NONMEM as compartment properties. Bioavailabilities, infusion durations/rates and lag times will be automatically detected.

Usage

autoDetectNONMEM(object, ...)

## S4 method for signature 'campsis_model'
autoDetectNONMEM(object, ...)

Arguments

object

object that has NONMEM special variables to be identified

...

extra arguments, unused

Value

updated object


Create a bioavailability for the specified compartment.

Description

Create a bioavailability for the specified compartment.

Usage

Bioavailability(compartment, rhs = "")

Arguments

compartment

compartment index

rhs

right-hand side part of the equation

Value

a bioavailability property


CAMPSIS model class.

Description

CAMPSIS model class.

Slots

model

a list of code records

parameters

model parameters

compartments

model compartments


Create a new CAMPSIS model.

Description

Create a new CAMPSIS model.

Usage

CampsisModel()

Value

a CAMPSIS model, empty


Code record class. See this code record as an abstract class. 2 implementations are possible: - properties record (lag, duration, rate & bioavailability properties) - statements record (main, ode & error records)

Description

Code record class. See this code record as an abstract class. 2 implementations are possible: - properties record (lag, duration, rate & bioavailability properties) - statements record (main, ode & error records)

Slots

comment

a comment, single character value

statements

model statements


Create a list of code records.

Description

Create a list of code records.

Usage

CodeRecords()

Value

an empty list of code records


Create a new comment.

Description

Create a new comment.

Usage

Comment(x)

Arguments

x

comment, single character string

Value

a comment


Comment class. A statement starting with #.

Description

Comment class. A statement starting with #.


Create a compartment.

Description

Create a compartment.

Usage

Compartment(index, name = NA)

Arguments

index

compartment index

name

compartment name (without prefix)

Value

an empty list of compartments


Compartment bioavailability class.

Description

Compartment bioavailability class.


Compartment infusion duration class.

Description

Compartment infusion duration class.


Compartment infusion rate class.

Description

Compartment infusion rate class.


Compartment initial condition class.

Description

Compartment initial condition class.


Compartment lag time class.

Description

Compartment lag time class.


Compartment properties class.

Description

Compartment properties class.


Compartment property class.

Description

Compartment property class.

Slots

compartment

related compartment index

rhs

right-hand side formula

comment

comment if any, single character string


Compartment class.

Description

Compartment class.

Slots

name

compartment name (without prefix)

index

compartment index


Create a list of compartments

Description

Create a list of compartments

Usage

Compartments()

Value

an empty list of compartments


Compartments class.

Description

Compartments class.

Slots

properties

compartment properties of the compartments defined in this class


Get default element from list.

Description

Get default element from list.

Usage

default(object, ...)

Arguments

object

list object

...

additional arguments

Value

the default element from list


Delete an element from this list.

Description

Delete an element from this list.

Usage

delete(object, x)

## S4 method for signature 'pmx_list,pmx_element'
delete(object, x)

## S4 method for signature 'pmx_list,integer'
delete(object, x)

## S4 method for signature 'compartments,compartment_property'
delete(object, x)

## S4 method for signature 'parameters,single_array_parameter'
delete(object, x)

## S4 method for signature 'parameters,double_array_parameter'
delete(object, x)

## S4 method for signature 'statements_record,model_statement'
delete(object, x)

## S4 method for signature 'statements_record,integer'
delete(object, x)

## S4 method for signature 'code_records,model_statement'
delete(object, x)

## S4 method for signature 'campsis_model,compartment_property'
delete(object, x)

## S4 method for signature 'campsis_model,parameter'
delete(object, x)

## S4 method for signature 'campsis_model,code_record'
delete(object, x)

## S4 method for signature 'campsis_model,model_statement'
delete(object, x)

Arguments

object

list object

x

element to delete or element index

Value

the updated list


Disable.

Description

Disable.

Usage

disable(object, x, ...)

## S4 method for signature 'parameters,character'
disable(object, x, ...)

## S4 method for signature 'campsis_model,character'
disable(object, x, ...)

Arguments

object

generic object

x

what needs to be disabled

...

extra arguments needed for disabling

Value

object with some disabled features


Double-array parameter class. This parameter has 2 indexes. It can thus be used to define correlations between parameters.

Description

Double-array parameter class. This parameter has 2 indexes. It can thus be used to define correlations between parameters.


(Infusion)-duration record class.

Description

(Infusion)-duration record class.


Create a new equation.

Description

Create a new equation.

Usage

Equation(lhs, rhs = "", comment = as.character(NA))

Arguments

lhs

left-hand side variable corresponding to the assigned variable name

rhs

right-hand side expression corresponding to a formula

comment

comment if any, single character string

Value

an equation


Equation class. Any statement in the form A = B.

Description

Equation class. Any statement in the form A = B.

Slots

lhs

left-hand side expression

rhs

right-hand side expression


Error record class.

Description

Error record class.


Create ERROR code record.

Description

Create ERROR code record.

Usage

ErrorRecord(code = character())

Arguments

code

code record

Value

an ERROR code record


Export function.

Description

Export function.

Usage

export(object, dest, ...)

## S4 method for signature 'campsis_model,character'
export(object, dest, ...)

## S4 method for signature 'campsis_model,rxode_type'
export(object, dest, ...)

## S4 method for signature 'campsis_model,mrgsolve_type'
export(object, dest, outvars = NULL, extra_params = character(0))

Arguments

object

generic object

dest

destination

...

optional arguments

outvars

additional variables to capture

extra_params

extra parameter names to be added. By default, they will be assigned a zero value.

Value

specific object depending on given destination


Export type class.

Description

Export type class.


Extract left-hand-side expression.

Description

Extract left-hand-side expression.

Usage

extractLhs(x, split = "=")

Arguments

x

character value

split

character where to split

Value

left-hand-side expression, not trimmed


Extract right-hand-side expression.

Description

Extract right-hand-side expression.

Usage

extractRhs(x, split = "=")

Arguments

x

character value

split

character where to split

Value

right-hand side expression


Extract text between brackets.

Description

Extract text between brackets.

Usage

extractTextBetweenBrackets(x)

Arguments

x

character value

Value

text between brackets (trimmed)


Bioavailability record class.

Description

Bioavailability record class.


Find an element in list.

Description

Find an element in list.

Usage

find(object, x)

## S4 method for signature 'pmx_list,pmx_element'
find(object, x)

## S4 method for signature 'compartments,compartment_property'
find(object, x)

## S4 method for signature 'statements_record,model_statement'
find(object, x)

## S4 method for signature 'code_records,model_statement'
find(object, x)

## S4 method for signature 'campsis_model,compartment'
find(object, x)

## S4 method for signature 'campsis_model,compartment_property'
find(object, x)

## S4 method for signature 'campsis_model,parameter'
find(object, x)

## S4 method for signature 'campsis_model,code_record'
find(object, x)

## S4 method for signature 'campsis_model,model_statement'
find(object, x)

Arguments

object

list object

x

element to find, only key slots need to be filled in

Value

the element from the list that has same name as x, or NULL if no element was found


Fix omega matrix for SAME OMEGA parameters that have NA values due to imperfections in Pharmpy import.

Description

Fix omega matrix for SAME OMEGA parameters that have NA values due to imperfections in Pharmpy import.

Usage

fixOmega(object)

## S4 method for signature 'parameters'
fixOmega(object)

Arguments

object

generic object

Value

the parameter that matches


Get element by index.

Description

Get element by index.

Usage

getByIndex(object, x)

## S4 method for signature 'pmx_list,integer'
getByIndex(object, x)

## S4 method for signature 'pmx_list,numeric'
getByIndex(object, x)

## S4 method for signature 'compartment_properties,compartment_property'
getByIndex(object, x)

## S4 method for signature 'parameters,parameter'
getByIndex(object, x)

Arguments

object

list object

x

element index

Value

element from the list whose index matches with provided index


Get an element from a list by name. Never return more than 1 element.

Description

Get an element from a list by name. Never return more than 1 element.

Usage

getByName(object, name)

## S4 method for signature 'pmx_list,character'
getByName(object, name)

Arguments

object

list object

name

element name to search for

Value

the element that was found or NULL if no element was found with the same name


Get the compartment index for the specified compartment name.

Description

Get the compartment index for the specified compartment name.

Usage

getCompartmentIndex(object, name)

## S4 method for signature 'compartments,character'
getCompartmentIndex(object, name)

## S4 method for signature 'campsis_model,character'
getCompartmentIndex(object, name)

Arguments

object

generic object that contains compartments information

name

compartment name

Value

the corresponding compartment index


Get element name.

Description

Get element name.

Usage

getName(x)

## S4 method for signature 'unknown_statement'
getName(x)

## S4 method for signature 'comment'
getName(x)

## S4 method for signature 'line_break'
getName(x)

## S4 method for signature 'equation'
getName(x)

## S4 method for signature 'ode'
getName(x)

## S4 method for signature 'if_statement'
getName(x)

## S4 method for signature 'compartment'
getName(x)

## S4 method for signature 'compartment_bioavailability'
getName(x)

## S4 method for signature 'compartment_lag_time'
getName(x)

## S4 method for signature 'compartment_infusion_duration'
getName(x)

## S4 method for signature 'compartment_infusion_rate'
getName(x)

## S4 method for signature 'compartment_initial_condition'
getName(x)

## S4 method for signature 'theta'
getName(x)

## S4 method for signature 'omega'
getName(x)

## S4 method for signature 'sigma'
getName(x)

## S4 method for signature 'main_record'
getName(x)

## S4 method for signature 'ode_record'
getName(x)

## S4 method for signature 'f_record'
getName(x)

## S4 method for signature 'lag_record'
getName(x)

## S4 method for signature 'duration_record'
getName(x)

## S4 method for signature 'rate_record'
getName(x)

## S4 method for signature 'init_record'
getName(x)

## S4 method for signature 'error_record'
getName(x)

Arguments

x

element to know the name

Value

the name of this element


Get the name of the given parameter in the CAMPSIS model.

Description

Get the name of the given parameter in the CAMPSIS model.

Usage

getNameInModel(x)

## S4 method for signature 'theta'
getNameInModel(x)

## S4 method for signature 'omega'
getNameInModel(x)

## S4 method for signature 'sigma'
getNameInModel(x)

Arguments

x

element to know the name

Value

the name of this parameter


Get element names from list.

Description

Get element names from list.

Usage

getNames(object)

## S4 method for signature 'pmx_list'
getNames(object)

Arguments

object

list object

Value

character vector with all the element names of this list


Get NONMEM name.

Description

Get NONMEM name.

Usage

getNONMEMName(object)

## S4 method for signature 'theta'
getNONMEMName(object)

## S4 method for signature 'omega'
getNONMEMName(object)

## S4 method for signature 'sigma'
getNONMEMName(object)

Arguments

object

generic object

Value

the NONMEM name associated with this object


Get prefix.

Description

Get prefix.

Usage

getPrefix(object, ...)

## S4 method for signature 'compartment_bioavailability'
getPrefix(object, ...)

## S4 method for signature 'compartment_lag_time'
getPrefix(object, ...)

## S4 method for signature 'compartment_infusion_duration'
getPrefix(object, ...)

## S4 method for signature 'compartment_infusion_rate'
getPrefix(object, ...)

## S4 method for signature 'compartment_initial_condition'
getPrefix(object, ...)

Arguments

object

generic object

...

e.g. dest='mrgsolve'

Value

the prefix of this object


Get record delimiter.

Description

Get record delimiter.

Usage

getRecordDelimiter(line)

Arguments

line

any line, single character value

Value

the record delimiter between brackets


Get record name.

Description

Get record name.

Usage

getRecordName(object)

## S4 method for signature 'compartment_bioavailability'
getRecordName(object)

## S4 method for signature 'compartment_lag_time'
getRecordName(object)

## S4 method for signature 'compartment_infusion_duration'
getRecordName(object)

## S4 method for signature 'compartment_infusion_rate'
getRecordName(object)

## S4 method for signature 'compartment_initial_condition'
getRecordName(object)

Arguments

object

generic object

Value

the name of the record


Get uncertainty on the parameters.

Description

Get uncertainty on the parameters.

Usage

getUncertainty(object, ...)

## S4 method for signature 'parameter'
getUncertainty(object, varcov, ...)

## S4 method for signature 'parameters'
getUncertainty(object, ...)

## S4 method for signature 'campsis_model'
getUncertainty(object, ...)

Arguments

object

generic object

...

extra arguments

varcov

variance covariance matrix

Value

data frame with standard error (se) and relative standard error (rse


Get variance-covariance matrix.

Description

Get variance-covariance matrix.

Usage

getVarCov(object)

## S4 method for signature 'parameters'
getVarCov(object)

## S4 method for signature 'campsis_model'
getVarCov(object)

Arguments

object

generic object

Value

a variance-covariance matrix (data frame) or NULL if no matrix present


Check if string contains CAMPSIS-style comments.

Description

Check if string contains CAMPSIS-style comments.

Usage

hasComment(x)

Arguments

x

character vector

Value

logical value


If-statement class. Any statement in the form if (condition) A = B.

Description

If-statement class. Any statement in the form if (condition) A = B.

Slots

condition

IF statement condition

equation

any equation or ODE


Create a new IF-statement.

Description

Create a new IF-statement.

Usage

IfStatement(condition, equation, comment = as.character(NA))

Arguments

condition

condition, single character string

equation

equation if condition is met

comment

comment if any, single character string

Value

an IF-statement


Get the index of an element in list.

Description

Get the index of an element in list.

Usage

indexOf(object, x)

## S4 method for signature 'pmx_list,pmx_element'
indexOf(object, x)

Arguments

object

list object

x

element to know the index

Value

index of this element


Create an infusion duration.

Description

Create an infusion duration.

Usage

InfusionDuration(compartment, rhs = "")

Arguments

compartment

compartment index

rhs

right-hand side part of the equation

Value

an infusion duration property


Create an infusion rate.

Description

Create an infusion rate.

Usage

InfusionRate(compartment, rhs = "")

Arguments

compartment

compartment index

rhs

right-hand side part of the equation

Value

an infusion rate property


Init record class.

Description

Init record class.


Create an initial condition.

Description

Create an initial condition.

Usage

InitialCondition(compartment, rhs = "")

Arguments

compartment

compartment index

rhs

right-hand side part of the equation

Value

an initial condition property


Check if string is a CAMPSIS comment (i.e. not an equation).

Description

Check if string is a CAMPSIS comment (i.e. not an equation).

Usage

isComment(x)

Arguments

x

character vector

Value

logical value


Is diagonal.

Description

Is diagonal.

Usage

isDiag(object)

## S4 method for signature 'double_array_parameter'
isDiag(object)

Arguments

object

generic object

Value

logical value


Check if string is an empty line.

Description

Check if string is an empty line.

Usage

isEmptyLine(x)

Arguments

x

character vector

Value

logical value


Say if line in record is an equation not.

Description

Say if line in record is an equation not.

Usage

isEquation(x)

Arguments

x

character value

Value

logical value


Say if line in record is an IF-statement.

Description

Say if line in record is an IF-statement.

Usage

isIfStatement(x)

Arguments

x

character value

Value

logical value


Say if line(s) in record is/are ODE or not.

Description

Say if line(s) in record is/are ODE or not.

Usage

isODE(x)

Arguments

x

character vector

Value

logical vector


Is record delimiter. A record delimiter is any line starting with [...].

Description

Is record delimiter. A record delimiter is any line starting with [...].

Usage

isRecordDelimiter(line)

Arguments

line

any line, single character value

Value

a logical value


Is strict record delimiter. A strict record delimiter is any line starting with [...] and followed by nothing but spaces or a possible comment.

Description

Is strict record delimiter. A strict record delimiter is any line starting with [...] and followed by nothing but spaces or a possible comment.

Usage

isStrictRecordDelimiter(line)

Arguments

line

any line, single character value

Value

a logical value


Lag record class.

Description

Lag record class.


Create a lag time for the specified compartment.

Description

Create a lag time for the specified compartment.

Usage

LagTime(compartment, rhs = "")

Arguments

compartment

compartment index

rhs

right-hand side part of the equation

Value

a lag time property


Line-break class. A linebreak in the model.

Description

Line-break class. A linebreak in the model.


Create a new line break.

Description

Create a new line break.

Usage

LineBreak()

Value

a line break


Main record class.

Description

Main record class.


Create MAIN code record.

Description

Create MAIN code record.

Usage

MainRecord(code = character())

Arguments

code

code record


Max index.

Description

Max index.

Usage

maxIndex(object)

## S4 method for signature 'parameters'
maxIndex(object)

Arguments

object

generic object

Value

max index


Min index.

Description

Min index.

Usage

minIndex(object)

## S4 method for signature 'parameters'
minIndex(object)

Arguments

object

generic object

Value

min index


Model statement class. Any statement in a code record.

Description

Model statement class. Any statement in a code record.

Slots

comment

a comment associated to this model statement


Model statements class. A list of statements.

Description

Model statements class. A list of statements.


CAMPSIS model suite.

Description

A library of models of all kinds, ready to be simulated in Campsis. These model templates are sorted into the following categories: pharmacokinetic (PK), pharmacodynamic (PD), target-mediated drug disposition (TMDD), NONMEM, literature and other (custom models).

Usage

model_suite

Format

A list with all the models:

pk

extensive list of pharmacokinetic (PK) model templates

pd

list of pharmacodynamic (PD) model templates, to be plugged into any pharmacokinetic (PK) model

tmdd

extensive list of target-mediated drug disposition (TMDD) model templates

nonmem

list of model templates translated from standard NONMEM control streams

literature

a couple of models coming from the literature

other

a couple of custom models

Source

https://calvagone.github.io/campsis.doc/

https://www.iconplc.com/solutions/technologies/nonmem/


Create an empty list of model statements.

Description

Create an empty list of model statements.

Usage

ModelStatements()

Value

a model statements object


Mrgsolve export type class.

Description

Mrgsolve export type class.


Convert code record for mrgsolve.

Description

Convert code record for mrgsolve.

Usage

mrgsolveBlock(record, init = NULL, capture = FALSE)

Arguments

record

code record

init

name of mrgsolve block

capture

'capture' instead of 'double'

Value

translated record for mrgsolve


Get the CAPTURE block for mrgsolve.

Description

Get the CAPTURE block for mrgsolve.

Usage

mrgsolveCapture(outvars, model)

Arguments

outvars

outvars in method simulate

model

CAMPSIS model

Value

CAPTURE block or character(0) if no variable in outvars


Get the compartment block for mrgsolve.

Description

Get the compartment block for mrgsolve.

Usage

mrgsolveCompartment(model)

Arguments

model

CAMPSIS model

Value

character vector, each value is a line


Get the MAIN block for mrgsolve.

Description

Get the MAIN block for mrgsolve.

Usage

mrgsolveMain(model)

Arguments

model

CAMPSIS model

Value

MAIN block


Get the OMEGA/SIGMA matrix for mrgsolve.

Description

Get the OMEGA/SIGMA matrix for mrgsolve.

Usage

mrgsolveMatrix(model, type = "omega")

Arguments

model

CAMPSIS model

type

either omega or sigma

Value

named matrix or character(0) if matrix is empty


Get the ODE block for mrgsolve.

Description

Get the ODE block for mrgsolve.

Usage

mrgsolveOde(model)

Arguments

model

CAMPSIS model

Value

ODE block


Get the parameters block for mrgsolve.

Description

Get the parameters block for mrgsolve.

Usage

mrgsolveParam(model, extra_params = character(0))

Arguments

model

CAMPSIS model

extra_params

extra parameter names to be added. By default, they will be assigned a zero value.

Value

character vector, 1 parameter per line. First one is header [PARAM].


Get the TABLE block for mrgsolve.

Description

Get the TABLE block for mrgsolve.

Usage

mrgsolveTable(model)

Arguments

model

CAMPSIS model

Value

TABLE block if at least one line in error record, character(0) otherwise


Create a new ordinary differential equation (ODE).

Description

Create a new ordinary differential equation (ODE).

Usage

Ode(lhs, rhs = "", comment = as.character(NA))

Arguments

lhs

left-hand side variable corresponding to derivative name, must start with 'A_'

rhs

right-hand side expression corresponding to derivative value

comment

comment if any, single character string

Value

an ODE


ODE record class.

Description

ODE record class.


ODE class. Any statement in the form d/dt(A_CMT) = B.

Description

ODE class. Any statement in the form d/dt(A_CMT) = B.


Create ODE code record.

Description

Create ODE code record.

Usage

OdeRecord(code = character())

Arguments

code

code record

Value

an ODE code record


Create an OMEGA parameter.

Description

Create an OMEGA parameter.

Usage

Omega(
  name = NA,
  index = NA,
  index2 = NA,
  value = NA,
  fix = FALSE,
  type = NULL,
  same = NA,
  label = NA,
  comment = NA
)

Arguments

name

parameter name, e.g. CL (prefix OMEGA will be added automatically)

index

parameter index

index2

second parameter index

value

parameter value

fix

parameter was fixed in estimation, logical value

type

variance type: 'var', 'sd', 'covar', 'cor', 'cv' or 'cv%'

same

NA by default, FALSE for first OMEGA followed by 'SAME' OMEGA's, TRUE for 'SAME' OMEGA's

label

parameter label, optional

comment

any comment, optional

Value

an OMEGA parameter


Omega parameter class.

Description

Omega parameter class.

Slots

same

logical value, tell if this omega is the same as the previous one


Parameter class. Any parameter in a pharmacometric model.

Description

Parameter class. Any parameter in a pharmacometric model.

Slots

name

parameter name, optional (although recommended)

index

parameter index, integer

value

parameter value (e.g. the estimated value from a modelling tool)

fix

logical value, say if parameter was fixed in the modelling phase

label

parameter label, any string

comment

any comment on this parameter, any string


Create a list of parameters.

Description

Create a list of parameters.

Usage

Parameters()

Value

an empty list of parameters


Parameters class.

Description

Parameters class.

Slots

varcov

associated variance-covariance matrix


Parse IF-statement. Assumption: isIfStatement method already called and returned TRUE.

Description

Parse IF-statement. Assumption: isIfStatement method already called and returned TRUE.

Usage

parseIfStatement(line, comment = as.character(NA))

Arguments

line

IF-statement as single character string value, comment omitted

comment

any comment, NA by default

Value

an IF statement object


Parse statements code and return CAMPSIS statements.

Description

Parse statements code and return CAMPSIS statements.

Usage

parseStatements(code)

Arguments

code

character vector containing all statements (text form)

Value

a list of CAMPSIS statements


Create a pattern.

Description

Create a pattern.

Usage

Pattern(x)

Arguments

x

regular expression

Value

a pattern


Pattern class.

Description

Pattern class.


PMX element class.

Description

PMX element class.


PMX position by element class.

Description

PMX position by element class.


PMX position by index class.

Description

PMX position by index class.


PMX position class.

Description

PMX position class.


Element position in list.

Description

Element position in list.

Usage

Position(x, after = TRUE)

Arguments

x

either an integer position (useful to add an element in a code record at a specified position) or an model element (element can be a model statement or a code record)

after

element to be added will be added after x (if after is TRUE) or before x (if after is FALSE)

Value

a position object


Process extra arguments.

Description

Process extra arguments.

Usage

processExtraArg(args, name, default = NULL, mandatory = FALSE)

Arguments

args

arguments list

name

argument name to retrieve

default

default value if argument is not present

mandatory

mandatory argument, logical value

Value

requested argument value


Properties record class.

Description

Properties record class.


(Infusion)-rate record class.

Description

(Infusion)-rate record class.


Generic read method to read data from a file or a folder.

Description

Generic read method to read data from a file or a folder.

Usage

read(file, ...)

Arguments

file

path to the file or folder to be read

...

extra arguments

Value

the object representation of the data contained in the file


Read all parameters files at once.

Description

Read all parameters files at once.

Usage

read.allparameters(folder)

Arguments

folder

path to folder or path to zipped project

Value

parameters object


Read a CAMPSIS model.

Description

Read a CAMPSIS model.

Usage

read.campsis(file)

Arguments

file

path to folder

Value

a CAMPSIS model


Read model file.

Description

Read model file.

Usage

read.model(file = NULL, text = NULL)

Arguments

file

path to file 'model.campsis'

text

model file as text, character (single or multiple lines)

Value

records object


Read parameters file.

Description

Read parameters file.

Usage

read.parameters(file, type)

Arguments

file

path to CSV file

type

parameter type: 'theta', 'omega' or 'sigma'

Value

parameters sub list


Read variance-covariance file.

Description

Read variance-covariance file.

Usage

read.varcov(file)

Arguments

file

path to CSV file

Value

variance-covariance matrix


Replace element by another in list.

Description

Replace element by another in list.

Usage

replace(object, x)

## S4 method for signature 'pmx_list,pmx_element'
replace(object, x)

## S4 method for signature 'pmx_list,pmx_list'
replace(object, x)

## S4 method for signature 'pmx_list,list'
replace(object, x)

## S4 method for signature 'compartments,compartment_property'
replace(object, x)

## S4 method for signature 'parameters,single_array_parameter'
replace(object, x)

## S4 method for signature 'parameters,double_array_parameter'
replace(object, x)

## S4 method for signature 'statements_record,model_statement'
replace(object, x)

## S4 method for signature 'code_records,model_statement'
replace(object, x)

## S4 method for signature 'campsis_model,compartment'
replace(object, x)

## S4 method for signature 'campsis_model,compartment_property'
replace(object, x)

## S4 method for signature 'campsis_model,parameter'
replace(object, x)

## S4 method for signature 'campsis_model,code_record'
replace(object, x)

## S4 method for signature 'campsis_model,model_statement'
replace(object, x)

Arguments

object

list object

x

element to replace

Value

list object or an error if the element does not exist in the list


Replace all occurrences in object.

Description

Replace all occurrences in object.

Usage

replaceAll(object, pattern, replacement, ...)

## S4 method for signature 'character,variable_pattern,character'
replaceAll(object, pattern, replacement, ...)

## S4 method for signature 'character,pattern,character'
replaceAll(object, pattern, replacement, ...)

## S4 method for signature 'model_statement,pattern,character'
replaceAll(object, pattern, replacement, ...)

## S4 method for signature 'equation,pattern,character'
replaceAll(object, pattern, replacement, ...)

## S4 method for signature 'if_statement,pattern,character'
replaceAll(object, pattern, replacement, ...)

## S4 method for signature 'compartment_property,pattern,character'
replaceAll(object, pattern, replacement, ...)

## S4 method for signature 'code_record,pattern,character'
replaceAll(object, pattern, replacement, ...)

## S4 method for signature 'code_records,pattern,character'
replaceAll(object, pattern, replacement, ...)

## S4 method for signature 'campsis_model,pattern,character'
replaceAll(object, pattern, replacement, ...)

## S4 method for signature 'campsis_model,character,character'
replaceAll(object, pattern, replacement, ...)

Arguments

object

generic object (e.g. model, code_record(s), etc.)

pattern

pattern to be replaced

replacement

replacement string

...

extra arguments

Value

the same object with all occurrences replaced


RxODE/rxode2 export type class.

Description

RxODE/rxode2 export type class.


Get code for rxode2

Description

Get code for rxode2

Usage

rxodeCode(model)

Arguments

model

CAMPSIS model

Value

corresponding model code for rxode2


Get the OMEGA/SIGMA matrix for rxode2.

Description

Get the OMEGA/SIGMA matrix for rxode2.

Usage

rxodeMatrix(model, type = "omega")

Arguments

model

CAMPSIS model

type

either omega or sigma

Value

omega/sigma named matrix


Get the parameters vector for rxode2.

Description

Get the parameters vector for rxode2.

Usage

rxodeParams(model)

Arguments

model

CAMPSIS model

Value

named vector with THETA values


Get a subset of an object.

Description

Get a subset of an object.

Usage

select(object, ...)

## S4 method for signature 'data.frame'
select(object, ...)

## S4 method for signature 'compartment_properties'
select(object, ...)

## S4 method for signature 'parameters'
select(object, ...)

Arguments

object

generic object

...

arguments to select

Value

subset of an object


Create a SIGMA parameter.

Description

Create a SIGMA parameter.

Usage

Sigma(
  name = NA,
  index = NA,
  index2 = NA,
  value = NA,
  fix = FALSE,
  type = NULL,
  label = NA,
  comment = NA
)

Arguments

name

parameter name, e.g. CL (prefix SIGMA will be added automatically)

index

parameter index

index2

second parameter index

value

parameter value

fix

parameter was fixed in estimation, logical value

type

variance type: 'var', 'sd', 'covar', 'cv' or 'cv%'

label

parameter label, optional

comment

any comment, optional

Value

a SIGMA parameter


Sigma parameter class.

Description

Sigma parameter class.


Single-array parameter class. This parameter has a single index value.

Description

Single-array parameter class. This parameter has a single index value.


Sort the specified list.

Description

Sort the specified list.

Usage

sort(x, decreasing = FALSE, ...)

## S4 method for signature 'compartment_properties'
sort(x, decreasing = FALSE, ...)

## S4 method for signature 'compartments'
sort(x, decreasing = FALSE, ...)

## S4 method for signature 'parameters'
sort(x, decreasing = FALSE, ...)

## S4 method for signature 'code_records'
sort(x, decreasing = FALSE, ...)

## S4 method for signature 'campsis_model'
sort(x, decreasing = FALSE, ...)

Arguments

x

list object

decreasing

increasing or decreasing order

...

extra arguments

Value

same list but ordered


Standardise.

Description

Standardise.

Usage

standardise(object, ...)

## S4 method for signature 'theta'
standardise(object, ...)

## S4 method for signature 'double_array_parameter'
standardise(object, parameters = NULL, ...)

## S4 method for signature 'parameters'
standardise(object, ...)

Arguments

object

generic object

...

extra arguments needed for standardisation

parameters

the list of parameters, to be provided only if parameter type is 'cor'

Value

standardised object


Statements record class.

Description

Statements record class.


Create a THETA parameter.

Description

Create a THETA parameter.

Usage

Theta(
  name = NA,
  index = NA,
  value = NA,
  fix = FALSE,
  label = NA,
  unit = NA,
  comment = NA
)

Arguments

name

parameter name, e.g. CL (prefix THETA will be added automatically)

index

parameter index

value

parameter value

fix

parameter was fixed in estimation, logical value

label

parameter label, optional

unit

parameter unit, optional

comment

any comment, optional

Value

a THETA parameter


Theta parameter class.

Description

Theta parameter class.

Slots

unit

parameter unit


ToString generic method.

Description

ToString generic method.

Usage

toString(object, ...)

## S4 method for signature 'unknown_statement'
toString(object, ...)

## S4 method for signature 'comment'
toString(object, ...)

## S4 method for signature 'line_break'
toString(object, ...)

## S4 method for signature 'equation'
toString(object, ...)

## S4 method for signature 'ode'
toString(object, ...)

## S4 method for signature 'if_statement'
toString(object, ...)

## S4 method for signature 'compartment'
toString(object, ...)

## S4 method for signature 'compartment_property'
toString(object, ...)

## S4 method for signature 'compartment_initial_condition'
toString(object, ...)

## S4 method for signature 'mrgsolve_model'
toString(object, ...)

Arguments

object

generic object

...

extra arguments needed for toString conversion

Value

character value/vector


Trim character vector. Remove all leading and trailing spaces.

Description

Trim character vector. Remove all leading and trailing spaces.

Usage

trim(x)

Arguments

x

character vector

Value

character vector without leading and trailing spaces


Unknown statement class. Any statement not recognized by campsismod.

Description

Unknown statement class. Any statement not recognized by campsismod.


Create a new ordinary differential equation (ODE).

Description

Create a new ordinary differential equation (ODE).

Usage

UnknownStatement(line, comment = as.character(NA))

Arguments

line

line which was not recognised

comment

comment if any, single character string

Value

an unknown statement


Update compartments list from the persisted records. Exported especially for package pmxtran. However, this method should not be called.

Description

Update compartments list from the persisted records. Exported especially for package pmxtran. However, this method should not be called.

Usage

updateCompartments(model)

Arguments

model

CAMPSIS model

Value

an updated CAMPSIS model, with an updated compartments list


Variable pattern class.

Description

Variable pattern class.


Create a variable pattern.

Description

Create a variable pattern.

Usage

VariablePattern(x)

Arguments

x

variable name

Value

a variable pattern


Write generic object to files.

Description

Write generic object to files.

Usage

write(object, file, ...)

## S4 method for signature 'parameters,character'
write(object, file, ...)

## S4 method for signature 'code_records,character'
write(object, file, ...)

## S4 method for signature 'campsis_model,character'
write(object, file, ...)

Arguments

object

generic object

file

path of the output file or directory

...

extra arguments

Value

logical value, TRUE for success, FALSE for failure


Write subset of parameters (theta, omega or sigma).

Description

Write subset of parameters (theta, omega or sigma).

Usage

writeParameters(object, file, ...)

Arguments

object

subset of parameters

file

filename

...

extra arguments, like defaultDf for empty parameters list

Value

TRUE if success


Write variance-covariance matrix.

Description

Write variance-covariance matrix.

Usage

writeVarcov(object, file)

Arguments

object

matrix

file

filename

Value

TRUE if success