Repository navigation
Expand file tree
/
Copy pathREADME.Rmd
More file actions
79 lines (58 loc) · 2.91 KB
/
Copy pathREADME.Rmd
File metadata and controls
79 lines (58 loc) · 2.91 KB
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
---
output: github_document
---
<!-- 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 = "100%"
)
```
# stratigraphr <img src="man/figures/logo.svg" align="right" style="float: right; height: 180px; margin-left: 1em">
<!-- badges: start -->
[](https://www.repostatus.org/#active)
[](https://CRAN.R-project.org/package=stratigraphr)
[](https://github.com/joeroe/stratigraphr/actions/workflows/R-CMD-check.yaml)
[](https://app.codecov.io/gh/joeroe/stratigraphr)
<!-- badges: end -->
stratigraphr is a tidy framework for working with archaeological stratigraphy and chronology in R.
It includes tools for reading, analysing, and visualising stratigraphic sequences (Harris matrices) and as directed graphs and an R interface to OxCal's Chronological Query Language (CQL).
## Installation
You can install the latest release of era [from CRAN](https://cran.r-project.org/package=stratigraphr) with:
``` r
install.packages("stratigraphr")
```
Or install the development version from GitHub with [pak](https://pak.r-lib.org/):
``` r
# install.packages("pak")
devtools::install_github("joeroe/stratigraphr")
```
## Usage
`stratigraph()` uses a data frame of stratigraphic relations to construct a *stratigraphic graph*:
```{r eg-stratigraph}
library(stratigraphr)
# Example stratigraphy from Harris (1979), figure 12:
harris12
stratigraph(harris12, "context", "above")
```
stratigraph objects are built on top of [tidygraph](https://tidygraph.data-imaginist.com/), which gives access to a powerful tidy interface for manipulating and analysing the stratigraphy.
It also works seamlessly with [ggraph](https://ggraph.data-imaginist.com/).
For example, to approximate a conventional 'Harris matrix' visualisation with ggraph:
```{r eg-ggraph}
library("ggraph")
# Example data after Harris 1979, Fig. 12
harris12 |>
stratigraph("context", "above") |>
ggraph(layout = "sugiyama") +
geom_edge_elbow() +
geom_node_label(aes(label = context), label.r = unit(0, "mm")) +
theme_graph()
```
For further information on:
* **Graph-bases stratigraphic analysis**, see `vignette("stratigraphr")`.
* **Chronological query language**, see `vignette("cql")`.
This package previous contained functions for tidy radiocarbon data.
These were deprecated in v0.3.0 and moved to the [c14](https://c14.joeroe.io) package.
See [c14's introductory vignette](https://c14.joeroe.io/articles/c14.html) for further information.