Package {diversityArch}


Type: Package
Title: Computes Diversity Indices for Archaeological Data
Version: 0.4.0
Description: Companion package of Arnaud Barat, Andreu Sansó, Maite Arilla-Osuna, Ruth Blasco, Iñaki Pérez-Fernández, Gabriel Cifuentes-Alcobenda, Rubén Llorente, Daniel Vivar-Ríos, Ella Assaf, Ran Barkai, Avi Gopher, & Jordi Rosell-Ardèvol (2026) <doi:10.1007/s10816-026-09802-3>. It computes Diversity Indices, decomposes several of them and computes bootstrap confidence intervals.
License: GPL-2
Imports: methods
Encoding: UTF-8
LazyData: true
Suggests: testthat (≥ 3.0.0)
Config/testthat/edition: 3
Config/roxygen2/version: 8.0.0
NeedsCompilation: no
Packaged: 2026-06-13 09:51:24 UTC; UIB
Author: Andreu Sansó [aut, cre], Arnaud Barat [aut], Jordi Rosell [aut]
Maintainer: Andreu Sansó <andreu.sanso@uib.eu>
Depends: R (≥ 3.5.0)
Repository: CRAN
Date/Publication: 2026-06-13 10:10:02 UTC

Data used in the examples

Description

Data frame with number of fragments of bones of unidentified species but identified group for several levels in Qesem (Israel). Data source: Blasco, R., Rosell, J., Assaf, E., Barkai, R., Gopher, A., (2024)

Usage

data(Qesem_f)

Value

Data frame with 4 observations (groups) and 7 levels.

Author(s)

Blasco, R., Rosell, J., Assaf, E., Barkai, R., Gopher, A.

Source

Blasco, R., Rosell, J., Assaf, E., Barkai, R., Gopher, A., 2024 <doi:10.1016/j.jhevol.2024.103509>

References

Barat, A. Sansó, A. Arilla-Osuna, M. Blasco, R., Pérez-Fernández, I., Cifuentes-Alcobenda, G. Llorente, R., Vivar-Ríos, D., Assaf, E. Barkai, R., Gopher, A. & Rosell-Ardèvol, J., 2026 <doi:10.1007/s10816-026-09802-3>. Blasco, R., Rosell, J., Assaf, E., Barkai, R., Gopher, A., 2024 <doi:10.1016/j.jhevol.2024.103509>

Examples

data(Qesem_f)
names(data)
# The following example replicates some of the results in
# Barat, A. Sansó, A. Arilla-Osuna, M. Blasco, R., Pérez-Fernández, I.,
# Cifuentes-Alcobenda, G. Llorente, R., Vivar-Ríos, D., Assaf, E. Barkai, R.,
# Gopher, A. & Rosell-Ardèvol, J. 2026. <doi:10.1007/s10816-026-09802-3>.
shannon_frag(Qesem_s$HU, Qesem_s$Group, Qesem_f$HU, Qesem_f$Group)

Data used in the examples

Description

Data frame with number of bones of different species and diferent levels in Qesem (Israel), and a factor related to the size of the animal. Data source: Blasco, R., Rosell, J., Assaf, E., Barkai, R., Gopher, A., (2024)

Usage

data(Qesem_s)

Value

Data frame with 15 observations and 7 levels.

Author(s)

Blasco, R., Rosell, J., Assaf, E., Barkai, R., Gopher, A.

Source

Blasco, R., Rosell, J., Assaf, E., Barkai, R., Gopher, A., 2024 <doi:10.1016/j.jhevol.2024.103509>

References

Barat, A. Sansó, A. Arilla-Osuna, M. Blasco, R., Pérez-Fernández, I., Cifuentes-Alcobenda, G. Llorente, R., Vivar-Ríos, D., Assaf, E. Barkai, R., Gopher, A. & Rosell-Ardèvol, J., 2026 <doi:10.1007/s10816-026-09802-3>. Blasco, R., Rosell, J., Assaf, E., Barkai, R., Gopher, A., 2024 <doi:10.1016/j.jhevol.2024.103509>

Examples

data(Qesem_s)
names(Qesem_s)
# The following example replicates some of the results in
# Barat, A. Sansó, A. Arilla-Osuna, M. Blasco, R., Pérez-Fernández, I.,
# Cifuentes-Alcobenda, G. Llorente, R., Vivar-Ríos, D., Assaf, E. Barkai, R.,
# Gopher, A. & Rosell-Ardèvol, J. 2026. <doi:10.1007/s10816-026-09802-3>.
all_indices(Qesem_s$HU)

Diversity indices

Description

Computes and prints all the diversity indices

Usage

all_indices(x, groups = NULL, B = 1000, cl = 0.95)

Arguments

x

Vector of dimension S (number of species) with the number of individuals observed in each species, or the distribution frequencies of species (in this case the Margalef and Menhinick indices and bootstrap intervals are not computed). NA values are allowed.

groups

Vector of dimension S of factors indicating the groups. If omitted, the decomposition of the indicators is not done.

B

Number of bootstrap samples. The default value is 1000.

cl

Confidence level. A value between 0 and 1. The default value is 0.95.

Value

No return value. It prints the value of all indicators

References

Arnaud Barat, Andreu Sansó, Maite Arilla-Osuna, Ruth Blasco, Iñaki Pérez-Fernández, Gabriel Cifuentes-Alcobenda, Rubén Llorente, Daniel Vivar-Ríos, Ella Assaf, Ran Barkai, Avi Gopher, & Jordi Rosell-Ardèvol (2026) <doi:10.1007/s10816-026-09802-3>.

See Also

shannon, dec_shannon, dominance, equitability, evenness, margalef, menhinick, simpson_D, simpson_E

Examples

data(Qesem_s)
all_indices(Qesem_s$HU)
all_indices(Qesem_s$HU, Qesem_s$Group)


Bootstrap estimates of the diversity indices

Description

Computes bootstrap standard error and confidence interval of the diversity indices

Usage

bs(x, ind = "shannon", B = 1000, cl = 0.95)

Arguments

x

Vector of dimension S (number of species) with the number of individuals observed in each species. NA values are allowed.

ind

Index to be computed. The default value is "shannon". Other possible values are: "simpson_E", "simpson_D", "menhinick", "margalef", "evenness", "equitability" and "dominance".

B

Number of bootstrap samples. The default is 1000.

cl

Confidence level. A value between 0 and 1. The default is 0.95.

Value

References

Arnaud Barat, Andreu Sansó, Maite Arilla-Osuna, Ruth Blasco, Iñaki Pérez-Fernández, Gabriel Cifuentes-Alcobenda, Rubén Llorente, Daniel Vivar-Ríos, Ella Assaf, Ran Barkai, Avi Gopher, & Jordi Rosell-Ardèvol (2026) <doi:10.1007/s10816-026-09802-3>.

See Also

shannon, dec_shannon, dominance, equitability, evenness, margalef, menhinick, simpson_D, simpson_E

Examples

data(Qesem_s)
bs(Qesem_s$HU)


Bootstrap estimates of the decomposed Shannon's diversity index

Description

Computes bootstrap confidence intervals of the Shannon's diversity index

Usage

bs_dec(x, groups, B = 1000, cl = 0.95)

Arguments

x

Vector of dimension S (number of species) with the number of individuals observed in each species. NA values are allowed.

groups

Vector of dimension S of factors indicating the groups of each species.

B

Number of bootstrap samples. The default is 1000.

cl

Confidence level. A value between 0 and 1. The default is 0.95.

Value

References

Arnaud Barat, Andreu Sansó, Maite Arilla-Osuna, Ruth Blasco, Iñaki Pérez-Fernández, Gabriel Cifuentes-Alcobenda, Rubén Llorente, Daniel Vivar-Ríos, Ella Assaf, Ran Barkai, Avi Gopher, & Jordi Rosell-Ardèvol (2026) <doi:10.1007/s10816-026-09802-3>.

See Also

shannon, dec_shannon

Examples

data(Qesem_s)
bs_dec(Qesem_s$HU, Qesem_s$Group)


Bootstrap estimates of the decomposed Shannon's diversity index with fragments

Description

Computes bootstrap confidence intervals of the decomposed Shannon's diversity index using evidence from fragments

Usage

bs_frag(x, gx, f, gf, B = 1000, cl = 0.95)

Arguments

x

Vector of dimension S (number of species) with the number of individuals observed in each species. NA values are allowed.

gx

Vector of dimension S of factors indicating the group of each species. G groups.

f

Vector of dimension G with the number (>0) of fragments in each group

gf

Vector of dimension G of factors indicating the groups to which the fragments "f" belong.

B

Number of bootstrap samples. The default is 1000.

cl

Confidence level. A value between 0 and 1. The default is 0.95.

Value

References

Arnaud Barat, Andreu Sansó, Maite Arilla-Osuna, Ruth Blasco, Iñaki Pérez-Fernández, Gabriel Cifuentes-Alcobenda, Rubén Llorente, Daniel Vivar-Ríos, Ella Assaf, Ran Barkai, Avi Gopher, & Jordi Rosell-Ardèvol (2026) <doi:10.1007/s10816-026-09802-3>.

See Also

shannon, dec_shannon, shannon_frag

Examples

data(Qesem_s)
data(Qesem_f)
bs_frag(Qesem_s$HU, Qesem_s$Group, Qesem_f$HU, Qesem_f$Group)


Check input

Description

Checks if x is a proper input

Usage

check_x(x)

Arguments

x

Vector of dimension S (number of species) with the number of individuals observed in each species, or the distribution frequencies of species. NA values are allowed.

Value

x without NA or 0 values


Decomposition of the equitability index

Description

Computes equitability and its decomposition

Usage

dec_equit(x, groups)

Arguments

x

Vector of dimension S (number of species) with the number of individuals observed in each species, or the distribution frequencies of species. NA values are allowed.

groups

Vector of dimension S of factors indicating the group of each species.

Value

References

Arnaud Barat, Andreu Sansó, Maite Arilla-Osuna, Ruth Blasco, Iñaki Pérez-Fernández, Gabriel Cifuentes-Alcobenda, Rubén Llorente, Daniel Vivar-Ríos, Ella Assaf, Ran Barkai, Avi Gopher, & Jordi Rosell-Ardèvol (2026) <doi:10.1007/s10816-026-09802-3>.

See Also

dec_shannon

Examples

data(Qesem_s)
dec_equit(Qesem_s$HU, Qesem_s$Group)


Shannon diversity decomposition

Description

Computes Shannon diversity and its decomposition

Usage

dec_shannon(x, groups)

Arguments

x

Vector of dimension S (number of species) with the number of individuals observed in each species, or the distribution frequencies of species. NA values are allowed.

groups

Vector of dimension S of factors indicating the group of each species.

Value

References

Arnaud Barat, Andreu Sansó, Maite Arilla-Osuna, Ruth Blasco, Iñaki Pérez-Fernández, Gabriel Cifuentes-Alcobenda, Rubén Llorente, Daniel Vivar-Ríos, Ella Assaf, Ran Barkai, Avi Gopher, & Jordi Rosell-Ardèvol (2026) <doi:10.1007/s10816-026-09802-3>.

See Also

shannon

Examples

data(Qesem_s)
dec_shannon(Qesem_s$HU, Qesem_s$Group)


Dominance index

Description

Modification of the Simpson's dominance index to be restricted between 0 and 1.

Usage

dominance(x)

Arguments

x

Vector of dimension S (number of species) with the number of individuals observed in each species, or the distribution frequencies of species. NA values are allowed.

Value

Dominance index (Modified Simpson's dominance index).

References

Arnaud Barat, Andreu Sansó, Maite Arilla-Osuna, Ruth Blasco, Iñaki Pérez-Fernández, Gabriel Cifuentes-Alcobenda, Rubén Llorente, Daniel Vivar-Ríos, Ella Assaf, Ran Barkai, Avi Gopher, & Jordi Rosell-Ardèvol (2026) <doi:10.1007/s10816-026-09802-3>.

See Also

simpson_D

Examples

data(Qesem_s)
dominance(Qesem_s$HU)


Equitability. J Pielou index

Description

Computes J Pielou index know as equitability

Usage

equitability(x)

Arguments

x

Vector of dimension S (number of species) with the number of individuals observed in each species, or the distribution frequencies of species. NA values are allowed.

Value

Equitability. J Pielou index.

References

Arnaud Barat, Andreu Sansó, Maite Arilla-Osuna, Ruth Blasco, Iñaki Pérez-Fernández, Gabriel Cifuentes-Alcobenda, Rubén Llorente, Daniel Vivar-Ríos, Ella Assaf, Ran Barkai, Avi Gopher, & Jordi Rosell-Ardèvol (2026) <doi:10.1007/s10816-026-09802-3>.

See Also

shannon

Examples

data(Qesem_s)
equitability(Qesem_s$HU)


Evenness index

Description

Modification of Simpson's evenness index to be restricted between 0 an 1.

Usage

evenness(x)

Arguments

x

Vector of dimension S (number of species) with the number of individuals observed in each species, or the distribution frequencies of species. NA values are allowed.

Value

Evenness index.

References

Arnaud Barat, Andreu Sansó, Maite Arilla-Osuna, Ruth Blasco, Iñaki Pérez-Fernández, Gabriel Cifuentes-Alcobenda, Rubén Llorente, Daniel Vivar-Ríos, Ella Assaf, Ran Barkai, Avi Gopher, & Jordi Rosell-Ardèvol (2026) <doi:10.1007/s10816-026-09802-3>.

See Also

simpson_E

Examples

data(Qesem_s)
evenness(Qesem_s$HU)


Margalef index

Description

Computes Margalef's index

Usage

margalef(x)

Arguments

x

Vector of dimension S (number of species) with the number of individuals observed in each species. NA values are allowed.

Value

Margalef index.

References

Arnaud Barat, Andreu Sansó, Maite Arilla-Osuna, Ruth Blasco, Iñaki Pérez-Fernández, Gabriel Cifuentes-Alcobenda, Rubén Llorente, Daniel Vivar-Ríos, Ella Assaf, Ran Barkai, Avi Gopher, & Jordi Rosell-Ardèvol (2026) <doi:10.1007/s10816-026-09802-3>.

Examples

data(Qesem_s)
margalef(Qesem_s$HU)


Menhinick index

Description

Computes Menhinick's index

Usage

menhinick(x)

Arguments

x

Vector of dimension S (number of species) with the number of individuals observed in each species. NA values are allowed.

Value

Menhinick index.

References

Arnaud Barat, Andreu Sansó, Maite Arilla-Osuna, Ruth Blasco, Iñaki Pérez-Fernández, Gabriel Cifuentes-Alcobenda, Rubén Llorente, Daniel Vivar-Ríos, Ella Assaf, Ran Barkai, Avi Gopher, & Jordi Rosell-Ardèvol (2026) <doi:10.1007/s10816-026-09802-3>.

Examples

data(Qesem_s)
menhinick(Qesem_s$HU)


Shannon diversity index

Description

Computes Shannon's diversity index

Usage

shannon(x)

Arguments

x

Vector of dimension S (number of species) with the number of individuals observed in each species, or the distribution frequencies of species. NA values are allowed.

Value

Shannon's diversity index (Entropy).

References

Arnaud Barat, Andreu Sansó, Maite Arilla-Osuna, Ruth Blasco, Iñaki Pérez-Fernández, Gabriel Cifuentes-Alcobenda, Rubén Llorente, Daniel Vivar-Ríos, Ella Assaf, Ran Barkai, Avi Gopher, & Jordi Rosell-Ardèvol (2026) <doi:10.1007/s10816-026-09802-3>.

See Also

dec_shannon, equitability

Examples

data(Qesem_s)
shannon(Qesem_s$HU)


Shannon diversity decomposition

Description

Computes Shannon diversity and its decomposition

Usage

shannon_frag(x, gx, f, gf)

Arguments

x

Vector of dimension S (number of species) with the number of individuals observed in each species. NA values are allowed. 0 values are converted to NA.

gx

Vector of dimension S of factors indicating the group of each species. G groups.

f

Vector of dimension G with the number (>0) of fragments in each group

gf

Vector of dimension G of factors indicating the groups to which the fragments "f" belong.

Value

References

Arnaud Barat, Andreu Sansó, Maite Arilla-Osuna, Ruth Blasco, Iñaki Pérez-Fernández, Gabriel Cifuentes-Alcobenda, Rubén Llorente, Daniel Vivar-Ríos, Ella Assaf, Ran Barkai, Avi Gopher, & Jordi Rosell-Ardèvol (2026) <doi:10.1007/s10816-026-09802-3>.

See Also

shannon

Examples

data(Qesem_s)
data(Qesem_f)
shannon_frag(Qesem_s$HU, Qesem_s$Group, Qesem_f$HU, Qesem_f$Group)


Simpson's dominance index

Description

Computes Simpson's dominance index.

Usage

simpson_D(x)

Arguments

x

Vector of dimension S (number of species) with the number of individuals observed in each species, or the distribution frequencies of species. NA values are allowed.

Value

Simpson's dominance index.

References

Arnaud Barat, Andreu Sansó, Maite Arilla-Osuna, Ruth Blasco, Iñaki Pérez-Fernández, Gabriel Cifuentes-Alcobenda, Rubén Llorente, Daniel Vivar-Ríos, Ella Assaf, Ran Barkai, Avi Gopher, & Jordi Rosell-Ardèvol (2026) <doi:10.1007/s10816-026-09802-3>.

See Also

dominance, simpson_E

Examples

data(Qesem_s)
simpson_D(Qesem_s$HU)


Simpson's evenness index

Description

Computes Simpson's evenness index.

Usage

simpson_E(x)

Arguments

x

Vector of dimension S (number of species) with the number of individuals observed in each species, or the distribution frequencies of species. NA values are allowed.

Value

Simpson's evenness index.

References

Arnaud Barat, Andreu Sansó, Maite Arilla-Osuna, Ruth Blasco, Iñaki Pérez-Fernández, Gabriel Cifuentes-Alcobenda, Rubén Llorente, Daniel Vivar-Ríos, Ella Assaf, Ran Barkai, Avi Gopher, & Jordi Rosell-Ardèvol (2026) <doi:10.1007/s10816-026-09802-3>.

See Also

evenness, simpson_D

Examples

data(Qesem_s)
simpson_E(Qesem_s$HU)