% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/buildDataFrame.R
\name{buildDataFrame}
\alias{buildDataFrame}
\title{Build a data frame for a certain gene and PI, in preparation for mixed model building.}
\usage{
buildDataFrame(
  obj,
  gene,
  pi = c("nn", "nnPair", "edge", "centroid", "nnCell", "nnPairCell"),
  piMat,
  moransI = FALSE,
  numNNs = 8,
  weightMats,
  pppDf
)
}
\arguments{
\item{obj}{A results object, for nearest neighbour distances,
the result of a call to \link{addWeightFunction}}

\item{gene}{A character string indicating the desired gene or gene pair}

\item{pi}{character string indicating the desired PI as outcome}

\item{piMat}{A data frame. Will be constructed if not provided}

\item{moransI}{A boolean, should Moran's I be calculated
in the linear mixed model}

\item{numNNs}{An integer, the number of nearest neighbours in the
weight matrix for the calculation of the Moran's I statistic}

\item{weightMats}{List of weight matrices for Moran's I calculation}

\item{pppDf}{Dataframe of point pattern-wise variables. It is precalculated
in fitLMMsSingle for speed, but will be newly constructed when not provided}
}
\value{
A dataframe
}
\description{
Build a data frame for a certain gene and PI, in preparation for mixed model building.
}
\examples{
example(addWeightFunction, "smoppix")
dfUniNN <- buildDataFrame(yangObj, gene = "SmVND2", pi = "nn")
# Example analysis with linear mixed model
library(lmerTest)
# Use sum coding for day to maintain interpretability of the intercept
mixedMod <- lmer(pi - 0.5 ~ day + (1 | root),
    weight = weight, data = dfUniNN,
    contrasts = list("day" = "contr.sum")
)
summary(mixedMod)
# Evidence for aggregation
}
\seealso{
\link{addWeightFunction}
}
