% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/NM2PM.R
\name{NM2PM}
\alias{NM2PM}
\title{Convert NONMEM to Pmetrics Data Files}
\usage{
NM2PM(data, ctl)
}
\arguments{
\item{data}{The name and extension of a NONMEM data (e.g. .csv) file in the working directory, or the full path to a file.}

\item{ctl}{The name and extension of a NONMEM control (e.g. .ctl) file in the working directory, or the full path to a file.}
}
\value{
A Pmetrics style PMmatrix data.frame.
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}

\code{NM2PM} will convert NONMEM .csv data files to Pmetrics csv data files.
}
\details{
The format of NONMEM and Pmetrics data .csv files are similar, but not quite identical.
A major difference is that the order of the columns are fixed in Pmetrics (not including covariates),
while they are user-determined in NONMEM, and specified in a control (.ctl) file.

A list of other differences follows by data item.
\itemize{
\item ID This item is the same in both formats and is required.
\item EVID This is the same in both formats but is not required in NONMEM.  Doses have an EVID
of 1 and observations 0.  EVID=4 (dose/time reset) is the same in Pmetrics and NONMEM.
EVID=2 (other event) and EVID=3 (dose reset) are not directly supported in Pmetrics, but if included
in a NONMEM file, will be converted into covariate values.  Specifically the value in the CMT variable will
be the covariate value for EVID=2, while for EVID=3, the covariate will be 1 at the time of the EVID=3 entry
and 0 othewise.  This allows for handling of these events in the Pmetrics model file using conditional statements.
\item DATE Pmetrics does not use dates, but will convert all NONMEM dates and times into relative times.
\item TIME Pmetrics uses relative times (as does NONMEM), but the NONMEM pre-processor will convert clock times
to relative times, as does \code{NM2PM}.
\item RATE NONMEM RATE items are converted by this function to Pmetrics DURation values.
\item AMT becomes DOSE in Pmetrics
\item ADDL is supported in both formats.  However, if NONMEM files contain an SS flag, it will be
incorporated as ADDL=-1 according to Pmetrics style.
\item II is the same in both formats.
\item INPUT in Pmetrics is similar to CMT in NONMEM for doses.
\item DV in NONMEM becomes OUT in Pmetrics.  Ensure that the units of OUT are consistent with the
units of DOSE.
\item OUTEQ In Pmetrics, this is roughly equivalent to CMT in NONMEM for observation events.
The lowest CMT value for any observation becomes OUTEQ=1; the next lowest becomes OUTEQ=2, etc.
\item SS Steady state dosing is incorporated into Pmetrics as ADDL=-1.
\item MDV Missing DV in NONMEM become OUT=-99 in Pmetrics.
\item Covariates These are copied from NONMEM to Pmetrics.  Note that Pmetrics does not allow
missing covariates at time 0 for each subject.
\item DROP Items marked as DROP in the NONMEM control file will not be included in the Pmetric data file.
}
It is strongly suggested to run \code{\link{PMcheck}} on the returned object for final adjusting.
}
\seealso{
\code{\link{PMcheck}}, \code{\link{PMwriteMatrix}}, \code{\link{PMwrk2csv}}
}
\author{
Michael Neely
}
