% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bibliometrics.R
\name{index}
\alias{index}
\title{Define a custom bibliometric index function}
\usage{
index(f, cumulative = FALSE)
}
\arguments{
\item{f}{A function to be applied to the index before comparison.}

\item{cumulative}{A logical on whether to apply a cumulative sum to the counts.}
}
\value{
A function that will compute the specified index.
}
\description{
Define a custom bibliometric index function
}
\examples{
# NOTE: These will all be less performant than their counterparts exported
# in this package, i.e., `h_index()`, `g_index()`, `i10_index()`.
set.seed(2018)
citations <- rgamma(30, shape = 2, scale = 10)

# Create an h-index
my_h_index <- index(force)
my_h_index(citations)

# Create a g-index function
my_g_index <- index(\(i) i * i, cumulative = TRUE)
my_g_index(citations)

# Create an i10-index
my_i10_index <- index(\(i) 10L)
my_i10_index(citations)

}
\seealso{
\link{bibliometrics}
}
