View source: R/create_variable_mapping.R
| create_variable_mapping | R Documentation | 
Create the variable_mapping table
create_variable_mapping(
  observation,
  observation_ancillary = NULL,
  location_ancillary = NULL,
  taxon_ancillary = NULL
)
| observation | (tbl_df, tbl, data.frame) The observation table. | 
| observation_ancillary | (tbl_df, tbl, data.frame) The optional observation_ancillary table. | 
| location_ancillary | (tbl_df, tbl, data.frame) The optional location_ancillary table. | 
| taxon_ancillary | (tbl_df, tbl, data.frame) The optional taxon_ancillary table. | 
This function collects specified data tables, extracts unique variable_name values from each, converts into long (attribute-value) form with the table name and variable_name values to the resulting table's "table_name" and "variable_name" columns, respectively. The resulting table's "mapped_system", "mapped_id", and "mapped_label" are filled with NA and are to be manually filled.
(tbl_df, tbl, data.frame) The variable_mapping table.
flat <- ants_L0_flat
# Create inputs to variable_mapping()
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"))
location_ancillary <- create_location_ancillary(
  L0_flat = flat,
  location_id = "location_id",
  variable_name = "treatment")
taxon_ancillary <- create_taxon_ancillary(
  L0_flat = flat,
  taxon_id = "taxon_id",
  variable_name = c(
    "subfamily", "hl", "rel", "rll", "colony.size", 
    "feeding.preference", "nest.substrate", "primary.habitat", 
    "secondary.habitat", "seed.disperser", "slavemaker.sp", 
    "behavior", "biogeographic.affinity", "source"),
  unit = c("unit_hl", "unit_rel", "unit_rll"))
# Create variable_mapping table
variable_mapping <- create_variable_mapping(
  observation = observation,
  observation_ancillary = observation_ancillary,
  location_ancillary = location_ancillary, 
  taxon_ancillary = taxon_ancillary)
variable_mapping
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.