% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/module3_replicate.R
\name{filter_bad_replicate}
\alias{filter_bad_replicate}
\title{Drop compounds with poor replicate reproducibility}
\usage{
filter_bad_replicate(cv, cv_max = 15, cor_result = NULL, r2_min = 0.8)
}
\arguments{
\item{cv}{A data frame from \code{\link[=calc_replicate_cv]{calc_replicate_cv()}}.}

\item{cv_max}{Maximum acceptable CV (percent). Default \code{15}.}

\item{cor_result}{Optional data frame from \code{\link[=calc_replicate_correlation]{calc_replicate_correlation()}}.}

\item{r2_min}{Minimum acceptable pairwise \eqn{R^2}. Default \code{0.8}.}
}
\value{
The subset of \code{cv} for compounds passing the CV threshold, with the
removed compound ids stored in \code{attr(x, "removed")}.
}
\description{
Removes compounds whose replicate coefficient of variation exceeds a
threshold. When a correlation table is supplied it also checks that the
replicate plates are globally concordant, warning if any pair falls below the
\eqn{R^2} threshold.
}
\examples{
norm <- norm_by_control(baseline_subtract(read_hts_plate(hts_primary_raw)))
cv <- calc_replicate_cv(norm)
good <- filter_bad_replicate(cv, cv_max = 20)
attr(good, "removed")

}
\seealso{
\code{\link[=calc_replicate_cv]{calc_replicate_cv()}}, \code{\link[=calc_replicate_correlation]{calc_replicate_correlation()}}
}
