This repository was archived by the owner on Jan 30, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
135 lines (96 loc) · 5.09 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
---
output: github_document
bibliography: vignettes/bibliography.bib
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = NULL
)
Sys.setenv(LANGUAGE = "en") # Force locale
```
# aion <img width=120px src="man/figures/logo.png" align="right" />
<!-- badges: start -->
[](https://github.com/tesselle/aion/actions)
[](https://app.codecov.io/gh/tesselle/aion)
[](https://www.codefactor.io/repository/github/tesselle/aion/overview/main)
[](https://cran.r-project.org/package=aion)
[](https://tesselle.r-universe.dev/aion){.pkgdown-devel}
[](https://cran.r-project.org/package=aion){.pkgdown-release}
[](https://cran.r-project.org/web/checks/check_results_aion.html){.pkgdown-release}
[](https://cran.r-project.org/package=aion){.pkgdown-release}
[](https://www.repostatus.org/#active)
[](https://doi.org/10.5281/zenodo.8032278)
[](https://doi.org/10.21105/joss.06210)
<!-- badges: end -->
## Overview
Base R ships with a lot of functionality useful for time series, in particular in the **stats** package. However, these features are not adapted to most archaeological time series. These are indeed defined for a given calendar era, they can involve dates very far in the past and the sampling of the observation time is (in most cases) not constant.
**aion** provides a system of classes and methods to represent and work with such time-series (and time intervals). Dates are represented as *rata die* [@reingold2018], i.e. the number of days since 01-01-01 (Gregorian), with negative values for earlier dates. This allows to represent dates independently of any calendar: it makes calculations and comparisons easier.
Once a time series is created with **aion**, any calendar can be used for printing or plotting data (defaults to Gregorian Common Era; see `vignette("aion")`).
**aion** does not provide tools for temporal modeling. Instead, it offers a simple API that can be used by other specialized packages (see [**kairos**](https://packages.tesselle.org/kairos/) or [**ananke**](https://packages.tesselle.org/ananke/)).
---
```{r citation, echo=FALSE, comment='', results='asis'}
cite <- utils::citation("aion")
print(cite, bibtex = FALSE)
```
## Installation
You can install the released version of **aion** from [CRAN](https://CRAN.R-project.org) with:
```{r cran-installation, eval=FALSE}
install.packages("aion")
```
And the development version from [GitHub](https://github.com/) with:
```{r gh-installation, eval=FALSE}
# install.packages("remotes")
remotes::install_github("tesselle/aion")
```
## Usage
```{r load}
## Load package
library(aion)
```
Time-series of ceramic counts:
```{r time-series, fig.width=7, fig.height=7}
## Get ceramic counts (data from Husi 2022)
data("loire", package = "folio")
## Keep only variables whose total is at least 600
keep <- c("01f", "01k", "01L", "08e", "08t", "09b", "15i", "15q")
## Get time midpoints
mid <- rowMeans(loire[, c("lower", "upper")])
## Create time-series
X <- series(
object = loire[, keep],
time = mid,
calendar = AD()
)
## Plot (default calendar)
plot(
x = X,
type = "h" # histogram like vertical lines
)
```
Plot time ranges:
```{r time-intervals, fig.width=7, fig.height=7}
## Create time intervals
Y <- intervals(
start = loire$lower,
end = loire$upper,
names = rownames(loire),
calendar = AD()
)
## Plot (default calendar)
plot(x = Y)
```
## 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`).
## Related Works
* [**era**](https://github.com/joeroe/era) provides a consistent representation of year-based time scales as a numeric vector with an associated era.
## Contributing
Please note that the **aion** project is released with a [Contributor Code of Conduct](https://www.tesselle.org/conduct.html). By contributing to this project, you agree to abide by its terms.
## References