PMreadMatrix
reads an NPAG .csv matrix input file into R.
Usage
PMreadMatrix(
file,
skip = 1,
sep = getPMoptions("sep"),
dec = getPMoptions("dec"),
date_format = "%AD",
time_format = "%AT",
quiet = F,
...
)
Arguments
- file
The name of the file to be loaded, including the full path if not in the current working directory (check with
getwd
).- skip
Skip n lines, with default set to 0.
- sep
Delimiter between columns, which is a comma by default, but can be changed with
setPMoptions
.- dec
Decimal separator, which is a period by default, but can be changed with
setPMoptions
.- date_format
Format for any dates. Default is set as year month day, with flexible separator. See
parse_date
in the readr package for more information on formatting dates. #' @param time_format Format for any clock times. Default is set as hours:minutes. Seeparse_date
in the readr package for more information on formatting times.- quiet
Default is false. If true, there will be no report to the console on the contents of file.
- ...
Other parameters to be passed to
read.table
Value
PMreadMatrix
returns a data.frame of class “PMmatrix” with one row per
event and the following columns.
- id
The id value for each event.
- evid
The evid value for each event, with 0=observation, 1=dose, 4=dose reset, which resets the time to 0 and all compartment amounts to 0. Note that evid=2 and 3 are not currently implemented.
- time
Relative time of the event in hours.
- dur
Duration of the dose. If dose is instantaneous, e.g. an oral dose into an absorptive compartment,
dur
should be 0. Any values greater than 0 are interpreted to mean a constant infusion of that duration, equalling thedose
.- dose
The dose. Be sure that the units are consistent with
out
.- addl
Optional number of additional doses to add at an interval specified in ii. The default if missing is 0. A value of -1 will cause steady state conditions to be approximated. Any value for addl other than 0 or missing requires input in ii.
- ii
The interdose interval for addl doses or dosing at steady state.
- input
The input number corresponding to
dose
.- out
The measured output, equivalent to “DV” in some other PK modeling software tools.
- outeq
The number of the output equation specified in the model file which corresponds to the
out
value.- C0
Assay error polynomial coefficient, e.g. SD = C0 + C1obs + C2obs^2 + C3*obs^3
- C1
See
C0
- C2
See
C0
- C3
See
C0
- ...
Additional columns are interpreted to be covariates.
If the file is successfully read and quiet
=F,
the column headers of the scanned file will be reported to the console as a validation check.
Details
The structure of a valid .csv file is fairly rigid. See PMcheckMatrix
for details. Note that PMreadMatrix
converts the column headers in the
matrixfile
from upper to lowercase for convenient referencing in R.