-
Notifications
You must be signed in to change notification settings - Fork 12
/
get_adrac.R
47 lines (44 loc) · 1.12 KB
/
get_adrac.R
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
#' @rdname db_getter_backend
#' @export
get_adrac <- function(db_url = get_db_url("adrac")) {
check_connection_to_url(db_url)
# read data
adrac <- db_url %>%
data.table::fread(
drop = c(
"FEATURE_DESC",
"LITHICS",
"POTTERY",
"IRON",
"FRUIT"
),
colClasses = "character",
showProgress = FALSE
) %>%
base::replace(., . == "", NA) %>%
dplyr::transmute(
labnr = .data[["LABNR"]],
c14age = .data[["C14AGE"]],
c14std = .data[["C14STD"]],
c13val = .data[["C13"]],
material = .data[["MATERIAL"]],
method = .data[["METHOD"]],
site = .data[["SITE"]],
country = .data[["COUNTRY"]],
feature = .data[["FEATURE"]],
period = .data[["PHASE"]],
lat = .data[["LAT"]],
lon = .data[["LONG"]],
comment = .data[["REMARK"]],
shortref = .data[["SOURCE"]]
) %>%
dplyr::filter(
is.na(.data[["method"]]) | .data[["method"]] != "TL"
) %>%
dplyr::mutate(
sourcedb = "adrac",
sourcedb_version = get_db_version("adrac")
) %>%
as.c14_date_list()
return(adrac)
}