Construct geopackage sqlite database from raw data
Usage
build_database(
fix_files,
device_files,
animal_files,
deployment_files,
dsn = "~/beastr_db.gpkg",
delete_dsn = TRUE,
locale = NULL,
tz = NULL,
quiet = TRUE
)
Arguments
- fix_files
A path, or paths, to files with telemetry fixes.
- device_files
A path, or paths, to CSV files containing information about the telemetry devices used. This must include an `ID` column.
- animal_files
A path, or paths, to CSV files containing information about the animals on which devices were deployed. This must include an `ID` column.
- deployment_files
A path, or paths, to CSV files specifying which devices were deployed on which animals and when. Columns must include: `AnimalID`, `DeviceID`, `In_Service`, and `Out_Service`.
- dsn
The path to the database file to be created. Currently must be a .gpkg file.
- delete_dsn
If TRUE, remove existing dsn.
- locale
Specify time zone using locale object. See [readr::locale()]
- tz
Specify time zone using known character string. ie "US/Pacific"
- quiet
Boolean passed to `sf::st_write()`
Details
This takes input files describing animals, devices, deployments, and the data files, and constructs a geopackage
Examples
if (FALSE) {
fix_file = system.file("inst/lotek/PinPoint33452.txt", package = "beastr")
device_file = system.file("inst/deployment/devices.csv", package = "beastr")
animal_file = system.file("inst/deployment/animals.csv", package = "beastr")
deploy_file = system.file("inst/deployment/deployments.csv", package = "beastr")
myDB = paste0(tempdir(check = TRUE), "/", "example.gpkg")
myDB = normalizePath(myDB) # windows?
build_database(fix_files = fix_file,
device_files = device_file,
animal_files = animal_file,
deployment_files = deploy_file,
dsn = myDB,
tz = "US/Pacific")
sf::st_layers(myDB)
}