-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME.Rmd
150 lines (109 loc) · 5.83 KB
/
README.Rmd
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
---
output: github_document
bibliography: vignettes/bibliography.bib
nocite: '@*'
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.align = "center",
fig.path = "man/figures/README-",
fig.width = 7,
out.width = NULL
)
Sys.setenv(LANGUAGE = "en") # Force locale
```
# ArchaeoPhases
<!-- badges: start -->
[![R-CMD-check](https://github.com/ArchaeoStat/ArchaeoPhases/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ArchaeoStat/ArchaeoPhases/actions/workflows/R-CMD-check.yaml)
[![codecov](https://codecov.io/gh/ArchaeoStat/ArchaeoPhases/graph/badge.svg)](https://app.codecov.io/gh/ArchaeoStat/ArchaeoPhases)
[![Dependencies](https://tinyverse.netlify.app/badge/ArchaeoPhases)](https://cran.r-project.org/package=ArchaeoPhases)
[![r-universe](https://ArchaeoStat.r-universe.dev/badges/ArchaeoPhases)](https://ArchaeoStat.r-universe.dev/ArchaeoPhases){.pkgdown-devel}
[![CRAN Version](https://www.r-pkg.org/badges/version/ArchaeoPhases)](https://cran.r-project.org/package=ArchaeoPhases){.pkgdown-release}
[![CRAN checks](https://badges.cranchecks.info/worst/ArchaeoPhases.svg)](https://cran.r-project.org/web/checks/check_results_ArchaeoPhases.html){.pkgdown-release}
[![CRAN Downloads](https://cranlogs.r-pkg.org/badges/ArchaeoPhases)](https://cran.r-project.org/package=ArchaeoPhases){.pkgdown-release}
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.8087121.svg)](https://doi.org/10.5281/zenodo.8087121)
[![DOI JSS](https://img.shields.io/badge/JSS-10.18637/jss.v093.c01-brightgreen)](https://doi.org/10.18637/jss.v093.c01)
<!-- badges: end -->
## Overview
Statistical analysis of archaeological dates and groups of dates. **ArchaeoPhases** allows to post-process Markov Chain Monte Carlo (MCMC) simulations from [ChronoModel](https://chronomodel.com) [@lanos2020], [Oxcal](https://c14.arch.ox.ac.uk/oxcal.html) [@bronkramsey2009] or [BCal](https://bcal.shef.ac.uk) [@buck1999]. This package provides functions for the study of rhythms of the long term from the posterior distribution of a series of dates (tempo and activity plot). It also allows the estimation and visualization of time ranges from the posterior distribution of groups of dates (e.g. duration, transition and hiatus between successive phases).
**ArchaeoPhases v2.0 brings a comprehensive package rewrite, resulting in the renaming of nearly all functions. For more information, please refer to `news(Version >= "2.0", package = "ArchaeoPhases")`.**
```{r citation, echo=FALSE, comment=''}
cite <- utils::citation("ArchaeoPhases")
print(cite, bibtex = FALSE)
```
## Installation
You can install the released version of **ArchaeoPhases** from [CRAN](https://CRAN.R-project.org) with:
```{r cran-installation, eval=FALSE}
install.packages("ArchaeoPhases")
```
And the development version from [GitHub](https://github.com/) with:
```{r gh-installation, eval=FALSE}
# install.packages("remotes")
remotes::install_github("ArchaeoStat/ArchaeoPhases")
```
You can install the 1.x releases from the CRAN archives:
```{r archive-installation, eval=FALSE}
# install.packages("remotes")
remotes::install_version("ArchaeoPhases", version = "1.8")
```
## Usage
**ArchaeoPhases** v2.0 uses [**aion**](https://packages.tesselle.org/aion/) for internal date representation. Look at `vignette("aion", package = "aion")` before you start.
These examples use data available through the [**ArchaeoData**](https://github.com/ArchaeoStat/ArchaeoData) package which is available in a [separate repository](https://archaeostat.r-universe.dev). **ArchaeoData** provides MCMC outputs from ChronoModel, OxCal and BCal.
```{r ArchaeoData, eval=FALSE}
## Install data package
install.packages("ArchaeoData", repos = "https://archaeostat.r-universe.dev")
```
```{r packages-load, message=FALSE}
## Load package
library(ArchaeoPhases)
```
Import a CSV file containing a sample from the posterior distribution:
```{r read-chronomodel}
## Construct the paths to the data
path <- file.path("chronomodel", "ksarakil")
path_event <- system.file(path, "Chain_all_Events.csv", package = "ArchaeoData")
path_phase <- system.file(path, "Chain_all_Phases.csv", package = "ArchaeoData")
## Read events from ChronoModel
(chrono_events <- read_chronomodel_events(path_event))
## Read phases from ChronoModel
(chrono_phases <- read_chronomodel_phases(path_phase))
```
### Analysis of a series of dates
```{r events-plot, fig.width=5, fig.align='default', fig.height=5, out.width='50%', fig.show='hold'}
## Plot the first event
plot(chrono_events[, 1], interval = "hdr")
## Plot all events
plot(chrono_events)
```
```{r tempo-plot, fig.width=5, fig.align='default', fig.height=5, out.width='50%', fig.show='hold'}
## Tempo plot
tp <- tempo(chrono_events, level = 0.95)
plot(tp)
## Activity plot
ac <- activity(chrono_events)
plot(ac)
```
### Analysis of a group of dates (phase)
```{r phases-boundaries}
bound <- boundaries(chrono_phases, level = 0.95)
as.data.frame(bound)
```
```{r phases-plot}
## Plot all phases
plot(chrono_phases)
```
```{r succession-plot}
plot(chrono_phases[, c("UP", "EPI"), ], succession = "hiatus")
plot(chrono_phases[, c("UP", "EPI"), ], succession = "transition")
```
## Translation
This package provides translations of user-facing communications, like messages, warnings and errors, and graphical elements (axis labels). The preferred language is by default taken from the locale. This can be overridden by setting of the environment variable `LANGUAGE` (you only need to do this once per session):
``` r
Sys.setenv(LANGUAGE = "<language code>")
```
Languages currently available are English (`en`) and French (`fr`).
## References