export_hobo_2008: Export Onset Hobo data to Access Database

View source: R/export_hobo_2008.R

export_hobo_2008R Documentation

Export Onset Hobo data to Access Database

Description

This function uses the raindancer package to processes data from Onset HOBO loggers used in the SEUG LTMVP from 2008-2019. It then exports the data to a Microsoft Access database.

Usage

export_hobo_2008(
  my_file,
  my_db,
  import_table,
  raw_data_table,
  prcp_data_table,
  temp_rh_data_table,
  details_table,
  verbose = TRUE,
  view = TRUE
)

Arguments

my_file

A character string of the complete file path of your *.csv file.

my_db

A connected database from RODBC.

import_table

A character string of the name of the import log table.

raw_data_table

A character string of the name of the raw data table.

prcp_data_table

A character string of the name of the processed precipitation data table.

temp_rh_data_table

A character string of the name of the processed temperature and relative humidity data table.

details_table

A character string of the name of the logger details table.

verbose

Logical. Show messages showing progress. Default is TRUE. If FALSE, messages are suppressed.

view

Logical. Prints data to console before writing them to the database. Default is TRUE. If FALSE, data are not printed and there is no prompt before writing data to the database.

Details

This function uses two functions from the raindacer package. import_hobo_2008 is usec to read Hobo data in into R, and then process_hobo is used to summarize the data. The processed data are then exported to a connected Microsoft Access database.

Value

Data is written to database tables. Objects are not returned.

See Also

raindancer, import_hobo_2008, raindance, sundance, process_hobo, RODBC, sqlSave, odbcConnectAccess2007

Examples

## Not run: 
library("raindancer")
library("dataprocessR")

# Connect to DB
my_db <- RODBC::odbcConnectAccess2007("C:/path/to/database.accdb")

# List files
my_dir <- "C:/path/to/data"
file_list <- list.files(my_dir, pattern = ".csv", full.names = TRUE,
                        recursive = FALSE)
# Select file
my_file <- file_list[10]

# Process file and save to database
export_hobo_2008(my_file = my_file, my_db = my_db,
                 import_table = "tblWxImportLog",
                 raw_data_table = "tblWxData_raw",
                 prcp_data_table = "tblWxData_PRCP",
                 temp_rh_data_table = "tblWxData_TEMP_RH",
                 details_table = "tblWxLoggerDetails")

## End(Not run)

scoyoc/dataprocessR documentation built on March 11, 2023, 6:02 a.m.