-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathget_kiteeastafrica.R
57 lines (53 loc) · 1.56 KB
/
get_kiteeastafrica.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
50
51
52
53
54
55
56
57
#' @rdname db_getter_backend
#' @export
get_kiteeastafrica <- function(db_url = get_db_url("kiteeastafrica")) {
check_connection_to_url("https://dataverse.harvard.edu")
# read data
kiteeastafrica <- db_url %>%
data.table::fread(
skip = 3,
encoding = "Latin-1",
drop = c(
"Field Number",
"Type of Date",
"Locality",
"Map Sheet",
"Elevation (m ASL)",
"Submitter",
"Date Submitted",
"Collector",
"Date Collected",
"Updater",
"Date Updated",
"Measured Age",
"MA Sigma",
"Delta 13 C Source",
"Significance",
"Stratigraphic Component",
"Context",
"Associated Taxa"
),
colClasses = "character",
showProgress = FALSE
) %>%
base::replace(., . == "", NA) %>%
dplyr::transmute(
labnr = .data[["Lab Number"]],
c14age = .data[["Normalized Age"]],
c14std = .data[["NA Sigma"]],
c13val = .data[["Delta 13C (per mil)"]],
material = .data[["Material Dated"]],
species = .data[["Taxa Dated"]],
site = .data[["Site Identifier"]],
lat = .data[["Latitude"]],
lon = .data[["Longitude"]],
shortref = .data[["References"]],
feature = .data[["Site Name"]],
comment = gsub("^, $", NA, paste0(.data[["Comments"]], .data[["Additional Information"]], sep = ", "))
) %>% dplyr::mutate(
sourcedb = "kiteeastafrica",
sourcedb_version = get_db_version("kiteeastafrica")
) %>%
as.c14_date_list()
return(kiteeastafrica)
}