-
Notifications
You must be signed in to change notification settings - Fork 12
/
get_calpal.R
49 lines (46 loc) · 1.2 KB
/
get_calpal.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
48
49
#' @rdname db_getter_backend
#' @export
get_calpal <- function(db_url = get_db_url("calpal")) {
check_connection_to_url(db_url)
# read data
calpal <- db_url %>%
data.table::fread(
sep = "\t",
na.strings = c("", "nd", "--", "n/a", "NoCountry"),
encoding = "UTF-8",
drop = c(
"ID",
"PHASE",
"LOCUS",
"CALAGE",
"CALSTD",
"SITEINFO",
"SUBPERIOD",
"TABLE"
),
colClasses = "character",
showProgress = FALSE
) %>%
dplyr::transmute(
method = .data[["METHOD"]],
labnr = .data[["LABNR"]],
c14age = .data[["C14AGE"]],
c14std = .data[["C14STD"]],
c13val = .data[["C13"]],
site = .data[["SITE"]],
sitetype = .data[["SITETYPE"]],
period = .data[["PERIOD"]],
culture = .data[["CULTURE"]],
material = .data[["MATERIAL"]],
species = .data[["SPECIES"]],
country = .data[["COUNTRY"]],
lat = .data[["LATITUDE"]],
lon = .data[["LONGITUDE"]],
shortref = .data[["REFERENCE"]]
) %>% dplyr::mutate(
sourcedb = "calpal",
sourcedb_version = get_db_version("calpal")
) %>%
as.c14_date_list()
return(calpal)
}