A convenient and reproducible toolkit for relative and absolute dating and analysis of chronological patterns. This package includes functions for chronological modeling and dating of archaeological assemblages from count data. It provides methods for matrix seriation. It also allows to compute time point estimates and density estimates of the occupation and duration of an archaeological site. kairos provides methods for:
seriate_rank()
and
seriate_average()
mcd()
event()
aoristic()
apportion()
tabula is a companion package to kairos that provides functions for visualization and analysis of archaeological count data.
You can install the released version of kairos from CRAN with:
install.packages("kairos")
And the development version from GitHub with:
# install.packages("remotes")
::install_github("tesselle/kairos") remotes
## Load packages
library(tabula)
library(kairos)
kairos only supports dates expressed in CE years
(BCE years must be given as negative numbers). All results are
rounded to zero decimal places (sub-annual precision does not
make sense in most situations). You can change this behavior with
options(kairos.precision = x)
(for x
decimal
places).
It assumes that you keep your data tidy: each variable (type/taxa) must be saved in its own column and each observation (sample/case) must be saved in its own row.
## Build an incidence matrix with random data
set.seed(12345)
<- matrix(sample(0:1, 400, TRUE, c(0.6, 0.4)), nrow = 20)
incidence1 <- incidence1 > 0 # logical
incidence1
## Get seriation order on rows and columns
## If no convergence is reached before the maximum number of iterations (100),
## it stops with a warning.
<- seriate_rank(incidence1, margin = c(1, 2), stop = 100))
(indices #> Plus d’une classe "PermutationOrder" est trouvée en cache : Utilisation de la première, depuis l’espace de noms 'tabula'
#> Aussi défini par 'kairos'
#> <RankPermutationOrder>
#> Permutation order for matrix seriation:
#> - Row order: 1 4 20 3 9 16 19 10 13 2 11 7 17 5 6 18 14 15 8 12...
#> - Column order: 1 16 9 4 8 14 3 20 13 2 6 18 7 17 5 11 19 12 15 10...
## Permute rows and columns
<- permute(incidence1, indices)
incidence2
## Plot matrix
::plot_heatmap(incidence1) +
tabula::scale_fill_manual(values = c("FALSE" = "white", "TRUE" = "black"))
ggplot2::plot_heatmap(incidence2) +
tabula::scale_fill_manual(values = c("FALSE" = "white", "TRUE" = "black")) ggplot2
Please note that the kairos project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.