odm_data: Create ODM formated dataframe

Description Usage Arguments Details Examples

View source: R/odm_data.R

Description

The function odm_data can be used to help in formating new data. odm_data takes a vector of dates and data and outputs a dataframe formated for use with the functions in this package. site_id, variable_id, and method_id need to already exist in their respective tables in the ODM.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
odm_data(
  date_time,
  data_value,
  utc_offset = -5,
  site_id,
  variable_id,
  qualifier_id = NA,
  method_id,
  source_id = 1,
  level_id = 0,
  channel = ODM
)

Arguments

date_time

local date time for each record

data_value

matching data value for each date time record

utc_offset

difference in hours from Coordinated Universal Time (UTC)

site_id

corresponds to an existing Sites record in the Sites table

variable_id

corresponds to an existing record in the Variables table

qualifier_id

corresponds to an existing record in the Qualifiers table

method_id

corresponds to an existing record in the Methods table

source_id

corresponds to an existing record in the Sources table

level_id

corresponds to a record in the QualityControlLevels table

channel

connection handle as returned by odbcConnect

Details

The output is a properly formated dataframe suitable for further use in workflows involving this package.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
# dates
date = seq(as.Date("2010/1/1"), as.Date("2011/1/1"), "days")
# dummy data values
value = 1:366

# creation of dataframe that meets the requirements of the ODM.
tmp = odm_data(date_time = date, data_value = value, site_id = 1,
 variable_id = 1, method_id = 9)

## End(Not run)

D-ESC/ODMr documentation built on Sept. 16, 2021, 10:52 a.m.