Create/edit EML attributes, custom units, and factors in a Shiny environment

create_attributes_table(data = NULL, attributes_table = NULL)

Arguments

data

(data.frame) the data.frame of data that needs an attribute table

attributes_table

(data.frame) an existing attributes table for data that needs to be updated (if specified along with data, all non-empty fields will be used over any values automatically generated from data)

Value

(list) a list of three items (an attributes table, a custom units table, a factors table)

Examples

# NOT RUN {
# Create a blank attributes table
foo <- create_attributes_table(NULL, NULL)

# Create an attributes table from a data file
data <- read.csv('foo.csv')
foo <- create_attributes_table(data, NULL)

# Edit an attributes table from an eml attributeList
attributes_table <- EML::get_attributes(eml@dataset@dataTable[[i]]@attributeList)$attributes
foo <- create_attributes_table(NULL, attributes_table)

# Edit an attributes table from an eml attributeList and data file
foo <- create_attributes_table(data, attributes_table)

# Once finished, use EML commands to transform tables into EML objects
attributeList <- EML::set_attributes(attributes = foo$attributes, factors = foo$factors)
unitlist <- EML::set_unitList(units = foo$units)
# }