% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/funs_with_without_repla.R
\name{optimal_matching}
\alias{optimal_matching}
\title{optimal_matching}
\usage{
optimal_matching(
  total_database,
  n_con,
  cluster_var,
  Id_Patient,
  total_cont_per_case,
  case_control,
  with_replacement = FALSE
)
}
\arguments{
\item{total_database}{a data frame that contains the cases and controls}

\item{n_con}{number of controls to be matched}

\item{cluster_var}{a variable that contains one case with all available controls to be pooled}

\item{Id_Patient}{Id of the patient}

\item{total_cont_per_case}{total number of controls that are available for each case}

\item{case_control}{a variable containing "case" and "control"}

\item{with_replacement}{Use replacement or not}
}
\value{
a data frame containing the cases and the corresponding number of controls
}
\description{
optimal_matching is performing the optimal match between cases and controls in an iterative way and
computational efficient way
}
\details{
Here is where I should put all my details. This is where I should give more examples if necessary
}
\examples{
optimal_matching(being_processed, n_con=2, cluster_var=cluster_case,
Id_Patient=Patient_Id, total_cont_per_case=total_control_per_case, case_control = case_control)
}
