Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added xronos to getter functions #150

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: c14bazAAR
Title: Download and Prepare C14 Dates from Different Source Databases
Description: Query different C14 date databases and apply basic data cleaning, merging and calibration steps. Currently available databases: 14cpalaeolithic, 14sea, adrac, agrichange, aida, austarch, bda, calpal, caribbean, eubar, euroevol, irdd, jomon, katsianis, kiteeastafrica, medafricarbon, mesorad, neonet, neonetatl, nerd, p3k14c, pacea, palmisano, rado.nb, rxpand, sard.
Version: 5.0.0
Description: Query different C14 date databases and apply basic data cleaning, merging and calibration steps. Currently available databases: 14cpalaeolithic, 14sea, adrac, agrichange, aida, austarch, bda, calpal, caribbean, eubar, euroevol, irdd, jomon, katsianis, kiteeastafrica, medafricarbon, mesorad, neonet, neonetatl, nerd, p3k14c, pacea, palmisano, rado.nb, rxpand, sard, xronos.
Version: 5.1.0
Authors@R:
c(person(given = "Clemens",
family = "Schmid",
Expand Down Expand Up @@ -96,5 +96,5 @@ Suggests:
testthat,
tidyr (>= 0.6.3),
writexl
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
VignetteBuilder: knitr
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export(get_radon)
export(get_radonb)
export(get_rxpand)
export(get_sard)
export(get_xronos)
export(is.c14_date_list)
export(mark_duplicates)
export(order_variables)
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 5.1.0

- added getter function for xronos database: `get_xronos`

# 5.0.0

- removed the databases radon and radon-b and replaced it with the new, merged database rado.nb
Expand Down Expand Up @@ -44,6 +48,7 @@
# 3.2.0

- added getter function for sard database: `get_sard`
>>>>>>> master

# 3.1.0

Expand Down
3 changes: 2 additions & 1 deletion R/get_c14data.R
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ get_all_parser_functions <- function() {
"sard" = c14bazAAR::get_sard,
"p3k14c" = c14bazAAR::get_p3k14c,
"neonet" = c14bazAAR::get_neonet,
"neonet" = c14bazAAR::get_neonetatl
"neonet" = c14bazAAR::get_neonetatl,
"xronos" = c14bazAAR::get_xronos
))
}

Expand Down
32 changes: 32 additions & 0 deletions R/get_xronos.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#' @rdname db_getter_backend
#' @export
get_xronos <- function(db_url = get_db_url("xronos")) {

check_connection_to_url("https://www.xronos.ch")

resp<-httr::GET(db_url)
nevrome marked this conversation as resolved.
Show resolved Hide resolved

xronos_data <- httr::content(resp,as="parsed") %>% unique() %>% tidyr::tibble()

xronos <- xronos_data %>%
dplyr::transmute(
labnr = .data[["labnr"]],
c14age = .data[["bp"]],
c14std = .data[["std"]],
c13val = .data[["delta_c13"]],
material = .data[["material"]],
species = .data[["species"]],
country = .data[["country"]],
site = .data[["site"]],
sitetype = .data[["site_type"]],
feature = .data[["feature"]],
lat = .data[["lat"]],
lon = .data[["lng"]]) %>%
dplyr::mutate(
sourcedb = "xronos",
sourcedb_version = get_db_version("xronos")
) %>%
c14bazAAR::as.c14_date_list()

return(xronos)
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ To suggest other archives to be queried you can join the discussion [here](https
| [**rado.nb**](https://radonb.ufg.uni-kiel.de) <br> latest <br> [`get_c14data("rado.nb")`](R/get_rado.nb.R) | Database for European 14C dates for the Neolithic, the Bronze Age and the Early Iron Age. [Christoph Rinne, Jutta Kneisel, Martin Hinz, Martin Furholt, Nina Krischke, Johannes Müller, Dirk Raetzel-Fabian, Marcel Rodens, Karl-Göran Sjögren, Helle Vandkilde and Hans-Peter Wotzka](https://radonb.ufg.uni-kiel.de). |
| [**rxpand**](https://github.com/jgregoriods/rxpand) <br> 2020-10-20 <br> [`get_c14data("rxpand")`](R/get_rxpand.R) | Radiocarbon dates for the spread of farming and ceramics in tropical South America by Jonas Gregorio de Souza. |
| [**sard**](https://github.com/emmaloftus/Southern-African-Radiocarbon-Database) <br> 2021-03-01 <br> [`get_c14data("sard")`](R/get_sard.R) | Southern-African-Radiocarbon-Database by [Emma Loftus, Peter J. Mitchell & Christopher Bronk Ramsey](https://www.cambridge.org/core/journals/antiquity/article/abs/an-archaeological-radiocarbon-database-for-southern-africa/26FE99E995C4507015704D552CB0C196). |
| [**XRONOS**](https://xronos.ch) <br> latest <br> [`get_c14data("xronos")`](R/get_xronos.R) | Open Access Database for absolute chronological archaeological information by Martin Hinz, Joe Roe and Clemens Schmid.

#### Deprecated databases

Expand Down
6 changes: 3 additions & 3 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
"codeRepository": "https://github.com/ropensci/c14bazAAR",
"issueTracker": "https://github.com/ropensci/c14bazAAR/issues",
"license": "https://spdx.org/licenses/GPL-2.0",
"version": "5.0.0",
"version": "5.1.0",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
"url": "https://r-project.org"
},
"runtimePlatform": "R version 4.4.0 (2024-04-24)",
"runtimePlatform": "R version 4.4.2 (2024-10-31)",
"author": [
{
"@type": "Person",
Expand Down Expand Up @@ -436,7 +436,7 @@
},
"SystemRequirements": null
},
"fileSize": "3130.491KB",
"fileSize": "3277.558KB",
"citation": [
{
"@type": "ScholarlyArticle",
Expand Down
1 change: 1 addition & 0 deletions data-raw/db_info_table.csv
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ sard,2021-03-01,1,https://raw.githubusercontent.com/emmaloftus/Southern-African-
p3k14c,2021-08-03,1,https://raw.githubusercontent.com/people3k/p3k14c/1.0.0/inst/p3k14c_scrubbed_fuzzed.csv
neonet,2023-12-08,1,https://digitallib.unipi.it/fedora/objects/mag:2814/datastreams/MMb714bbfacf4af2ce1fd7025e3789a99b/content
neonetatl,2023-12-08,1,https://digitallib.unipi.it/fedora/objects/mag:2627/datastreams/MM54ff3698c0ea78b77469ce6462c2ca36/content
xronos,today,1,https://xronos.ch/data.csv
20 changes: 20 additions & 0 deletions data-raw/variable_reference.csv
Original file line number Diff line number Diff line change
Expand Up @@ -601,3 +601,23 @@ shortref,neonetatl,bib
site,neonetatl,Site Name
sitetype,neonetatl,
species,neonetatl,Material Species
,xronos,id
labnr,xronos,labnr
,xronos,source_database
c14age,xronos,bp
c14std,xronos,std
,xronos,cal_bp
,xronos,cal_std
site,xronos,site
,xronos,site_phase
feature,xronos,feature
,xronos,period
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't that fit to c14bazAAR.period, which is defined as

Historico-cultural period of sample context

and usually contains values like "Bronze Age" etc.

,xronos,typochronological_unit
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should fit to c14bazAAR.culture, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw. the variable definition table is available here: https://github.com/ropensci/c14bazAAR/blob/master/data-raw/variable_definition.csv

,xronos,ecochronological_unit
material,xronos,material
country,xronos,country
c13val,xronos,delta_c13
lat,xronos,lat
lon,xronos,lng
sitetype,xronos,site_type
species,xronos,species
Binary file modified data/db_info_table.rda
Binary file not shown.
Binary file modified data/example_c14_date_list.rda
Binary file not shown.
2 changes: 1 addition & 1 deletion man/c14bazAAR-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion man/db_getter_backend.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified man/figures/README_map_figure.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/testthat/test_c14_date_list_convert.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ test_that("as.sf gives back a sf object with the correct columns", {
expect_equal(
colnames(result),
c(
paste0("data.", colnames(example_c14_date_list)),
paste0(colnames(example_c14_date_list)),
"geom"
)
)
Expand Down
6 changes: 3 additions & 3 deletions vignettes/simple_plotting.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,15 @@ adrac_sf <- adrac %>% as.sf()
This tabular data structure contains the spatial point information for each date in a column *geom*, but also the initial columns of the input dataset: *data.\**

```{r, echo=FALSE}
adrac_sf %>% dplyr::select(data.labnr, data.c14age, data.c14std, geom)
adrac_sf %>% dplyr::select(labnr, c14age, c14std, geom)
```

It can be manipulated with the powerful dplyr functions. We `filter` out all dates from one particular publication (*Moga 2008*), `group` the dates `by` *site* and apply the `summarise` command to keep only one value per group. As we do not define an operation to fold the other variables in the input table, they are removed. Only the geometry column remains.

```{r}
Moga_spatial <- adrac_sf %>%
dplyr::filter(grepl("Moga 2008", data.shortref)) %>%
dplyr::group_by(data.site) %>%
dplyr::filter(grepl("Moga 2008", shortref)) %>%
dplyr::group_by(site) %>%
dplyr::summarise(.groups = "drop")
```

Expand Down