aboutsummaryrefslogtreecommitdiff
path: root/man/geomean.Rd
blob: 506e64dc1fe1fa9606007faa6ae40b7f1f079b98 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/geomean.R
\name{geomean}
\alias{geomean}
\title{Calculate the geometric mean}
\usage{
geomean(x, na.rm = FALSE)
}
\arguments{
\item{x}{Vector of numbers}

\item{na.rm}{Should NA values be omitted?}
}
\value{
The geometric mean
}
\description{
Based on some posts in a thread on Stackoverflow
\url{http://stackoverflow.com/questions/2602583/geometric-mean-is-there-a-built-in}
This function returns NA if NA values are present and na.rm = FALSE
(default). If negative values are present, it gives an error message.
If at least one element of the vector is 0, it returns 0.
}
\examples{
geomean(c(1, 3, 9))
geomean(c(1, 3, NA, 9))
\dontrun{geomean(c(1, -3, 9)) # returns an error}
}
\author{
Johannes Ranke
}

Contact - Imprint