% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/PM_data.R
\name{PMmatrixRelTime}
\alias{PMmatrixRelTime}
\title{Convert Absolute Dates and Times to Relative Hours}
\usage{
PMmatrixRelTime(
  data,
  idCol = "id",
  dateCol = "date",
  timeCol = "time",
  evidCol = "evid",
  format,
  split = F
)
}
\arguments{
\item{data}{The name of an R data object.}

\item{idCol}{A character vector with the name
of the id column in \code{data} or the number of the id column, default is \dQuote{id}}

\item{dateCol}{A character vector with the name of the date
column in \code{data} or the number of the date column, default is \dQuote{date}}

\item{timeCol}{A character vector with the name of the time
column in \code{data} or the number of the time column, default is \dQuote{time}}

\item{evidCol}{A character vector with the name of the event id
column in \code{data} or the number of the evid column, default is \dQuote{evid}}

\item{format}{Format of the date and time columns; default is
m/d/y and h:m:s, as specified in the chron::chron function.
Note the separators in each case (/ for dates and : for times).
For dates, \emph{m} is months in digits and can be one or two digits;
\emph{d} is the day of the month, again as one or two digits;
\emph{y} is the year in 2 or 4 digits.  For times, all values can be one
or two digits, but time is in 24-hour format, and \emph{s} is required
to avoid ambiguity.}

\item{split}{If \emph{true}, \code{PMmatrixRelTime} will split every \code{id}
into id.block, where block is defined by a dose reset, or evid=4,
e.g. \code{id} 1.1, 1.2, 1.3, 2.1, 3.1, 3.2.}
}
\value{
Returns a dataframe with columns \emph{id, evid, relTime}.
If \code{split}=T all evid values that were previously 4 will be converted to 1.
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#superseded}{\figure{lifecycle-superseded.svg}{options: alt='[Superseded]'}}}{\strong{[Superseded]}}

Convert dates/times to relative times.
This function is largely superseded as it is called automatically when data
are initialized as a \link{PM_data} object. There is rarely a need to call it directly
any longer.
}
\details{
\code{PMmatrixRelTime} will convert absolute dates and times in a dataset
into relative hours, suitable for Pmetrics analysis.  Additionally, the user has
the option to split subjects into pseudosubjects every time a dose reset (evid=4)
is encountered.
}
\seealso{
\code{\link{PMreadMatrix}}
}
\author{
Michael Neely
}
