% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/nm_helpers.R
\name{merge_cov_locf}
\alias{merge_cov_locf}
\title{Merge Time-Varying Covariates by LOCF}
\usage{
merge_cov_locf(
  nm,
  cov_df,
  value_cols,
  time_col,
  median_fb = TRUE,
  verbose = FALSE,
  subj_col = "SUBJID",
  dat_col = "DAT2",
  tim_col = "TIME"
)
}
\arguments{
\item{nm}{data.frame with key columns \code{subj_col}, \code{dat_col},
\code{tim_col}.}

\item{cov_df}{data.frame with \code{subj_col}, \code{time_col}, and one or
more value columns.}

\item{value_cols}{character vector of value columns in \code{cov_df} to
bring into \code{nm}.}

\item{time_col}{name of the time column in \code{cov_df}, parsed by
\code{\link{parse_dtc}}.}

\item{median_fb}{logical. If TRUE (default), fill remaining NA values with
the column-wise median of \code{cov_df}.}

\item{verbose}{logical. Print median fill counts. Default FALSE.}

\item{subj_col}{subject ID column name. Default "SUBJID".}

\item{dat_col}{date column name in \code{nm}. Default "DAT2".}

\item{tim_col}{time column name in \code{nm}. Default "TIME".}
}
\value{
\code{nm} with \code{value_cols} added.
}
\description{
Merge time-varying covariate columns into a NM-style data.frame using LOCF
(with LOCB for records before the first source). Subjects/records still NA
after LOCF/LOCB can be filled with the column-wise median of \code{cov_df}.
}
