Make variables list

make_vars_list(data, data_colnames = setdiff(names(data), c("Timestamp",
  "Sample", "Site")))

Arguments

data

data frame with columns of data to describe

data_colnames

a string vector of column names with data values. by default all columns except "Timestamp", "Sample", and "Site" if they are included.

Value

nested list for each column in data describing variable name and units

Details

This function creates the object needed for the variables argument in db_insert_results_m, db_insert_results_ts, db_insert_results_samples, db_insert_results_samples_profile, based on a data frame with the data to insert. The data frame supplied should include only the columns with data and optionally a column called Timestamp. For each column of data, provide a unique codename for the variable as well as the term and units from the controlled vocabularies. By default the column name will be used as the variable code.

See also

Other interactive helpers: get_site_codes, get_variable_codes

Examples

# NOT RUN {
ts <- data.frame(
 Timestamp = c(
 "2018-06-27 13:45:00",
 "2018-06-27 13:55:00"),
  "wl" = c(1, 1.5))
vars_list <- make_vars_list(ts)
# }