% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/util_plotfunctions.R
\name{print.probability}
\alias{print.probability}
\title{Print an object of class "probability"}
\usage{
\method{print}{probability}(x, elements = NULL, subset = NULL, digits = TRUE, ...)
}
\arguments{
\item{x}{Object of class "probability", obtained with \code{\link[=Pr]{Pr()}}.}

\item{elements}{character or integer vector, or \code{NULL} (default): elements of the "probability" object to display. The syntax is the same as with \code{\link[base:Extract]{[}}. If \code{NULL}, the elements \verb{$values} and \verb{$quantiles} are displayed together in a special way.}

\item{subset}{Named list or named vector: which variate values to display. For the variates corresponding to the names in this list, only the vector of values corresponding to that variate is displayed.}

\item{digits}{positive number or \code{NULL} or \code{TRUE} (default): minimal number of significant digits, see \code{\link[base:print.default]{base::print.default()}}. If value is \code{TRUE}, then the significant digits for elements \verb{$values} and \verb{$quantiles} are determined from their respective \verb{$values.MCaccuracy} and \verb{$quantiles.MCaccuracy} elements of the \code{probability} object, see \code{\link[=Pr]{Pr()}}; whereas \verb{$samples} elements use 2 significant digits.}

\item{...}{Other parameters to be passed to \code{\link[base:print]{base::print()}}.}
}
\value{
Its \code{x} argument, \link[base:invisible]{invisibly}; see \code{\link[base:print]{base::print()}}.
}
\description{
This \code{\link[base:print]{base::print()}} method is a utility to display selected elements of a "probability" object obtained with \code{\link[=Pr]{Pr()}}; typically its posterior probabilies (element \verb{$values}) and their variabilities (element \verb{$quantiles}). If the \code{Y} or \code{X} variates are joint variates, this method also allow to display only selected values of them
}
\examples{
## Load the example `learnt` object calculated from the "penguins" dataset;
## variates: 'species' and 'bill_len'
learnt <- learntExample

## Calculate the 3 x 2 probabilities for the 3 species
## given bill-lengths of 43 mm and 44 mm

Y <- data.frame(species = c('Adelie', 'Chinstrap', 'Gentoo'))
X <- data.frame(bill_len = c(43, 44))

probs <- Pr(Y = Y, X = X, learnt = learnt, parallel = 1)

## display the values and variabilities of these probabilities
print(probs)

## diplay 'values' only, and only for the species value 'Gentoo'
print(probs, elements = 'values', subset = list(species = 'Gentoo'))

}
\seealso{
\code{\link[=Pr]{Pr()}} to calculate posterior probabilities and quantiles.

\code{\link[=plot.probability]{plot.probability()}} to plot probabilities and quantiles calculated by `Pr()'.
\code{\link[=hist.probability]{hist.probability()}} to plot the variability of the probabilities as a distribution.
}
