% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/format_p.R
\name{format_p}
\alias{format_p}
\title{p-values formatting}
\usage{
format_p(
  p,
  stars = FALSE,
  stars_only = FALSE,
  whitespace = TRUE,
  name = "p",
  missing = "",
  decimal_separator = NULL,
  digits = 3,
  ...
)
}
\arguments{
\item{p}{value or vector of p-values.}

\item{stars}{Add significance stars (e.g., p < .001***). For Bayes factors,
the thresholds for "significant" results are values larger than 3, 10, and 30.}

\item{stars_only}{Return only significance stars.}

\item{whitespace}{Logical, if \code{TRUE} (default), preserves whitespaces. Else,
all whitespace characters are removed from the returned string.}

\item{name}{Name prefixing the text. Can be \code{NULL}.}

\item{missing}{Value by which \code{NA} values are replaced. By default, an
empty string (i.e. \code{""}) is returned for \code{NA}.}

\item{decimal_separator}{Character, if not \code{NULL}, will be used as
decimal separator.}

\item{digits}{Number of significant digits. May also be \code{"scientific"}
to return exact p-values in scientific notation, or \code{"apa"} to use
an APA 7th edition-style for p-values (equivalent to \code{digits = 3}).
If \code{"scientific"}, control the number of digits by adding the value as
a suffix, e.g.m \code{digits = "scientific4"} to have scientific notation
with 4 decimal places.}

\item{...}{Arguments from other methods.}
}
\value{
A formatted string.
}
\description{
Format p-values.
}
\examples{
format_p(c(.02, .065, 0, .23))
format_p(c(.02, .065, 0, .23), name = NULL)
format_p(c(.02, .065, 0, .23), stars_only = TRUE)

model <- lm(mpg ~ wt + cyl, data = mtcars)
p <- coef(summary(model))[, 4]
format_p(p, digits = "apa")
format_p(p, digits = "scientific")
format_p(p, digits = "scientific2")
}
