Write tables to file
write_tables(
path,
sep = ",",
observation = NULL,
location = NULL,
taxon = NULL,
dataset_summary = NULL,
observation_ancillary = NULL,
location_ancillary = NULL,
taxon_ancillary = NULL,
variable_mapping = NULL
)
(character) A path to the directory in which the files will be written.
(character) Field delimiter to use when writing files. Default is comma.
(tbl_df, tbl, data.frame) The observation table.
(tbl_df, tbl, data.frame) The location table.
(tbl_df, tbl, data.frame) The taxon table.
(tbl_df, tbl, data.frame) The dataset_summary table.
(tbl_df, tbl, data.frame) The observation_ancillary table.
(tbl_df, tbl, data.frame) The location_ancillary table.
(tbl_df, tbl, data.frame) The taxon_ancillary table.
(tbl_df, tbl, data.frame) The variable_mapping table.
ecocomDP tables as sep
delimited files
# Create directory for the tables
mypath <- paste0(tempdir(), "/data")
dir.create(mypath)
# Create a couple inputs to write_tables()
flat <- ants_L0_flat
observation <- create_observation(
L0_flat = flat,
observation_id = "observation_id",
event_id = "event_id",
package_id = "package_id",
location_id = "location_id",
datetime = "datetime",
taxon_id = "taxon_id",
variable_name = "variable_name",
value = "value",
unit = "unit")
observation_ancillary <- create_observation_ancillary(
L0_flat = flat,
observation_id = "observation_id",
variable_name = c("trap.type", "trap.num", "moose.cage"))
# Write tables to file
write_tables(
path = mypath,
observation = observation,
observation_ancillary = observation_ancillary)
#> Writing tables to file:
#> observation
#> observation_ancillary
dir(mypath)
#> [1] "observation.csv" "observation_ancillary.csv"
# Clean up
unlink(mypath, recursive = TRUE)