% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/seqwrap.R
\name{seqwrap_summarise}
\alias{seqwrap_summarise}
\title{Summarise seqwrapResults objects}
\usage{
seqwrap_summarise(
  x,
  summaries = TRUE,
  evaluations = TRUE,
  errors = TRUE,
  verbose = TRUE
)
}
\arguments{
\item{x}{A seqwrapResults object}

\item{summaries}{Logical, should summaries be combined?}

\item{evaluations}{Logical, should evaluations be combined?}

\item{errors}{Logical, should errors be combined?}

\item{verbose, }{Logical should progress be printed? Default TRUE}
}
\value{
A list (invisibly) with up to two data frames: \code{summaries},
combined parameter summaries from each model, and \code{evaluations}, combined
diagnostics from each model. Entries are omitted when the corresponding
slot of \code{x} is empty or the user disables them via the \code{summaries} /
\code{evaluations} arguments.
}
\description{
Summarise seqwrapResults objects
}
\details{
This functions attempts to summarize results from the summary and evaluation
functions applied in each iteration during modelling. The function expects
that the summary and evaluation functions return data frames.
}
\examples{
# Load packages and prepare data for examples -------------------------------

library(seqwrap)

if (requireNamespace("glmmTMB", quietly = TRUE)) {
library(glmmTMB)

# Simulate n targets
dat <- simcounts(n_genes = 10000)

# Save simulated data as separate objects
counts <- dat$data
metadata <- dat$metadata

# Prepare library size for use as offset
metadata$ln_libsize <- log(colSums(counts[,-1]))


# A mixed effects negative binomial model of RNA-seq counts -----------------

# Populate the seqwrap container
container <- seqwrap_compose(
  modelfun = glmmTMB::glmmTMB,
  arguments = list(
    formula = y ~ x + (1|cluster) + offset(ln_libsize),
    family = glmmTMB::nbinom2()
  ),
  data = counts,
  metadata = metadata,
  samplename = "sample"
)

# Run seqwrap using the container on a subset of targets
results <- seqwrap(container,
                   subset = 1:5,
                   cores = 1)


# Summarise results only contains the subset
summaries <- seqwrap_summarise(results)

# Get summaries
summaries$summaries

# Get model evaluations
summaries$evaluations
}


}
