-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
110 lines (78 loc) · 4.3 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
---
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.setlocale("LC_MESSAGES", 'en_GB.UTF-8') # Force locale
```
# aion <img width=120px src="man/figures/logo.png" align="right" />
<!-- badges: start -->
[![R-CMD-check](https://github.com/tesselle/aion/workflows/R-CMD-check/badge.svg)](https://github.com/tesselle/aion/actions)
[![codecov](https://codecov.io/gh/tesselle/aion/branch/main/graph/badge.svg?token=UgoOXsZW86)](https://app.codecov.io/gh/tesselle/aion)
[![CodeFactor](https://www.codefactor.io/repository/github/tesselle/aion/badge/main)](https://www.codefactor.io/repository/github/tesselle/aion/overview/main)
[![Dependencies](https://tinyverse.netlify.app/badge/aion)](https://cran.r-project.org/package=aion)
[![r-universe](https://tesselle.r-universe.dev/badges/aion)](https://tesselle.r-universe.dev/aion){.pkgdown-devel}
[![CRAN Version](http://www.r-pkg.org/badges/version/aion)](https://cran.r-project.org/package=aion){.pkgdown-release}
[![CRAN checks](https://badges.cranchecks.info/worst/aion.svg)](https://cran.r-project.org/web/checks/check_results_aion.html){.pkgdown-release}
[![CRAN Downloads](http://cranlogs.r-pkg.org/badges/aion)](https://cran.r-project.org/package=aion){.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 Zenodo](https://zenodo.org/badge/DOI/10.5281/zenodo.8032278.svg)](https://doi.org/10.5281/zenodo.8032278)
[![DOI JOSS](https://joss.theoj.org/papers/10.21105/joss.06210/status.svg)](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. 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.
---
```{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 = calendar("AD")
)
## Plot (default calendar)
plot(
x = X,
type = "h" # histogram like vertical lines
)
```
## 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