% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/efficient_round.R
\name{efficient_round}
\alias{efficient_round}
\title{Efficient Round}
\usage{
efficient_round(design, n, tol = 1e-05, seed = NULL)
}
\arguments{
\item{design}{a dataframe with a \code{Weight} column and one or more design-variable columns
(\code{Point} for single-factor designs, \code{x1}, \code{x2}, \ldots for multi-factor designs).}

\item{n}{an integer that represents the desired number of observations of the exact design}

\item{tol}{optional parameter for the consideration of an integer in the rounding process}

\item{seed}{optional integer seed for reproducibility. When the rounded weights sum to less
than \code{n}, a random tie-breaking step is used; supplying \code{seed} makes that step
deterministic by calling \code{set.seed(seed)} immediately before it. \code{NULL} (default)
leaves the global RNG state unchanged.}
}
\value{
a data.frame with the same columns as \code{design}, with \code{Weight} replaced by
integer observation counts summing to \code{n}.
}
\description{
Takes an approximate design, and a number of points and converts the design to
an approximate design. It uses the multiplier (n - l/2) and evens the total
number of observations afterwards.
}
\examples{
design_test <- data.frame("Point" = seq(1, 5, length.out = 7),
         "Weight" = c(0.1, 0.0001, 0.2, 0.134, 0.073, 0.2111, 0.2818))

efficient_round(design_test, 20)

exact_design <- efficient_round(design_test, 21)
aprox_design <- exact_design
aprox_design$Weight <- aprox_design$Weight/sum(aprox_design$Weight)

# Reproducible tie-breaking
efficient_round(design_test, 20, seed = 42)
}
