% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/procmod_frame.R
\name{.procmod_coerce_value}
\alias{.procmod_coerce_value}
\alias{.procmod_coerce_value.default}
\alias{.procmod_coerce_value.dist}
\alias{.procmod_coerce_value.numeric}
\alias{.procmod_coerce_value.logical}
\alias{.procmod_coerce_value.factor}
\alias{.procmod_coerce_value.character}
\title{Internal function coercing the data to an object storable in a procmod frame.}
\usage{
.procmod_coerce_value(x, nrows = 0, ...)

\method{.procmod_coerce_value}{default}(x, nrows = 0, ...)

\method{.procmod_coerce_value}{dist}(x, nrows = 0, ...)

\method{.procmod_coerce_value}{numeric}(x, nrows = 0, ...)

\method{.procmod_coerce_value}{logical}(x, nrows = 0, ...)

\method{.procmod_coerce_value}{factor}(x, nrows = 0, levels = NULL, ...)

\method{.procmod_coerce_value}{character}(x, nrows = 0, levels = NULL, ...)
}
\arguments{
\item{x}{The data to coerce}

\item{nrows}{an interger value specifying the number of row
of the returned matrix}

\item{contrasts}{see the \code{contrasts_arg} argument
of the \code{\link[ProcMod]{procmod_frame}}
constructor.}
}
\value{
a new numeric matrix with correct size.
}
\description{
Object storable in a procmod frame are matrices, data frame and dist objects.
they must have all the same number of rows. If the number of row is not specified
or set to zero, then no check is done. Otherwise depending of the version of
the \code{.procmod_coerce_value} function, if the requested number of rows doesn't match
the actual one of the coerced value, or the value is recycled to fit the requested number
or an error is generated.

The defaut version of the function \code{.procmod_coerce_value} applies to
matrix and data frame object. It just check that number of row of the coerced
data structure is compatible with the number of row of the procmod frame. if
need the rows of the coerced data strucuture are recycled to fit the needed
number. The only constraint is that the target number of row is a multiple of
the row count of the coerced matrix.

The version for distance object just checks that the number of
elements compared in the matrix is equal to the number of elements
analyzed in the model (number of rows)

When applied to a vector the conversion transform
the vector into a single column matrix.

\code{Character} and \code{factor} are coerced to a
data frame where each column is a factor.
}
\note{
Internal function do not use.
}
\author{
Eric Coissac <eric.coissac@metabarcoding.org>

Christelle Gonindard-Melodelima <christelle.gonindard@metabarcoding.org>
}
