-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathget_nerd.R
41 lines (38 loc) · 1.1 KB
/
get_nerd.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
#' @rdname db_getter_backend
#' @export
get_nerd <- function(db_url = get_db_url("nerd")) {
check_connection_to_url(db_url)
nerd <- db_url %>%
data.table::fread(
drop = c(
"DateID",
"SiteID",
"LocQual"
),
colClasses = "character",
showProgress = FALSE,
na.strings = c("datatable.na.strings", "", "NA")
) %>%
dplyr::transmute(
labnr = paste_ignore_na(.data[["LabID"]], .data[["OthLabID"]]),
c14age = .data[["CRA"]],
c14std = .data[["Error"]],
c13val = .data[["DC13"]],
material = .data[["Material"]],
species = .data[["Species"]],
site = .data[["SiteName"]],
sitetype = .data[["SiteType"]],
country = .data[["Country"]],
feature = .data[["SiteContext"]],
lat = .data[["Latitude"]],
lon = .data[["Longitude"]],
comment = paste_ignore_na(.data[["Problems"]], .data[["Comments"]], sep = " "),
shortref = .data[["Source"]]
) %>%
dplyr::mutate(
sourcedb = "nerd",
sourcedb_version = get_db_version("nerd")
) %>%
as.c14_date_list()
return(nerd)
}