write_tables: Write tables to file

Description Usage Arguments Value Examples

View source: R/utilities.R

Description

Write tables to file

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
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
)

Arguments

path

(character) A path to the directory in which the files will be written.

sep

(character) Field delimiter to use when writing files. Default is comma.

observation

(tbl_df, tbl, data.frame) The observation table.

location

(tbl_df, tbl, data.frame) The location table.

taxon

(tbl_df, tbl, data.frame) The taxon table.

dataset_summary

(tbl_df, tbl, data.frame) The dataset_summary table.

observation_ancillary

(tbl_df, tbl, data.frame) The observation_ancillary table.

location_ancillary

(tbl_df, tbl, data.frame) The location_ancillary table.

taxon_ancillary

(tbl_df, tbl, data.frame) The taxon_ancillary table.

variable_mapping

(tbl_df, tbl, data.frame) The variable_mapping table.

Value

ecocomDP tables as sep delimited files

Examples

 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
# 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)

dir(mypath)

# Clean up
unlink(mypath, recursive = TRUE)

ecocomDP documentation built on Oct. 19, 2021, 1:08 a.m.