# Examples

To execute the examples shown in this vignette, load the package:

library(chronochrt)

## Examples

This vignette demonstrates examples of chronological datasets which have been compiled from the literature. They are included in the package (see first example) or alternatively can be downloaded here.

### Examples 1: Chonological table

This example illustrates the main purpose of the package: facilitating the hassle free drawing of chronological tables. Many archaeological cultures have competing chronological systems or temporal shifts in their sub-groups and/or spatial distributions. This example highlights regional chronological differences of the Urnfield Culture and the phases are an extract of a table presented by St. Knöpke (2009, p. 15).

# Data from St. Knöpke, Der urnenfelderzeitliche Männerfriedhof von Neckarsulm.
# Konrad Theiss Verlag (Stuttgart 2009), p. 15.
UC_Chronology <- import_chron(path = "ex_urnfield_periods.xlsx",
"Region", "Name", "Start", "End", "Level")

To access it directly from the package, use

UC_Chronology <- import_chron(path = system.file("extdata/ex_urnfield_periods.xlsx", package = 'chronochrt'),
"Region", "Name", "Start", "End", "Level")

Then, create the chronological chart by:

 plot_chronochrt(UC_Chronology,
axis_title = "BCE",
size_text = 4,
line_break = 22,
filename = "UC-Chronology.png", plot_dim = c(16, 10, "cm"))

And that’s it! Because a file name as well as physical dimensions were provided, the chart would be saved right away as “UC-Chronology.png” in your working directory, with the specified size of 16x10 cm when running the code. It would look like this:

 plot_chronochrt(UC_Chronology,
axis_title = "BCE",
size_text = 4,
line_break = 22)

### Example 2: Occupation phases and other data

Additionally, the package can be used to display any kind of temporal information. The following example ‒ whilst being very circumstantial in connections of the data ‒ highlights how different types of temporal data can be merged. This dataset is partially based on the cemetery data of the Wellcome Osteological Research Database (https://www.museumoflondon.org.uk/collections/other-collection-databases-and-libraries/centre-human-bioarchaeology/osteological-database) as well as general information for the labels. According to place of burial - during this time a partial indicator of socio-economic status - some cemeteries were placed in groups (the region). Their occupation phases were entered through the start and end arguments. Further, the death numbers of major plague events were added as a separate region.

Again, the first step is to load the chronological dataset:

London_cemeteries <- import_chron(path = "ex_London_cem.xlsx", package = 'ChronochRt'),
"Region", "Name", "Start", "End", "Level")

Then add some labels, e.g. ‘12.04.1665 - The “Great Plague of London” begins’ as well as some numbers from London’s plague mortality bills and other interesting facts via the following code in different parts of the plot:

London_labels <-add_label_text(region = "low socio-economic status",
year = 1665,
label = "12.04.1665:\n The \"Great Plague of London\"\n begins",
position = 1.98,
new = TRUE) %>%
year = c(1559, 1660, 1670),
label = c("1559: Coronation of Elizabeth I ", "1664: Sighting of a bright comet", "1666: Great Fire of London"),
position = 1.98,
new =  FALSE) %>%
new =  FALSE) 
 plot_chronochrt(data = London_cemeteries,
color_line = "grey55")