% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/indices.R
\name{RII}
\alias{RII}
\title{Relative interaction index (RII)}
\usage{
RII(
  dat,
  colIDstand = "ID",
  colIDfocal = "focal",
  colProp = "prop",
  colY = "yield",
  avgIfReps = FALSE
)
}
\arguments{
\item{dat}{data.frame with one yield value per row and with at least four columns: the identifier of each stand, the identifier of the focal genotype or species in each stand, the sowing (plant) proportion of the focal in each stand, and the focal yield in each stand (see the example below); a stand with a single proportion equals to 1 will be interpreted as a monovarietal culture ("pure stand"), a mixture otherwise (and its proportions should sum to 1)}

\item{colIDstand}{column name for the stand identifiers}

\item{colIDfocal}{column name for the focal identifiers}

\item{colProp}{column name for the proportions}

\item{colY}{column name for the yield values}

\item{avgIfReps}{if TRUE, replicates of monovarietals will be averaged; if FALSE, the presence of replicates will return an error}
}
\value{
input data.frame with an extra column named "RII"
}
\description{
Computes the relative interaction index (RII) as defined in Armas et al (2004, \doi{10.1890/03-0650}): RII_i = (Y_i(j) - Y_i) / (Y_i(j) + Y_i) where Y_i(j) is the yield per plant of i when mixed with j, and Y_i is the yield per plant of i when growned in isolation.
Missing values are forbidden.
}
\examples{
sow_density <- 200
(dat <- data.frame(ID=c("geno1", "geno2", "mixg1g2", "mixg1g2"),
                   focal=c("geno1", "geno2", "geno1", "geno2"),
                   prop=c(1, 1, 0.5, 0.5),
                   yield_qt_ha=c(50, 40, 25, 22)))
dat$yield_g_m2 <- (dat$yield_qt_ha / 10^4) * 10^6
dat$yield_g_plant <- dat$yield_g_m2 / (sow_density * dat$prop)
RII(dat, colY = "yield_g_plant")
}
\seealso{
\code{\link{RIInet}}, \code{\link{RY}}, \code{\link{RYT}}, \code{\link{RYP}}, \code{\link{RYM}}
}
\author{
Timothee Flutre
}
