attach_historic_data: Load the historic ems database as a tbl

View source: R/ems_duckdb.R

attach_historic_dataR Documentation

Load the historic ems database as a tbl

Description

You can then use dplyr verbs such as filter, select, summarize, etc. For basic importing of historic data based on ems_id, date, and parameter, you can use the function read_historic_data

Usage

attach_historic_data(con = NULL)

Arguments

con

DBI connection object, most likely created by connect_historic_db().

Value

A dplyr connection to the duckdb database. See tbl for more.

Examples

## Not run: 
library(dplyr)

con <- connect_historic_db()

hist_tbl <- attach_historic_data(con)
result <- hist_tbl %>%
 group_by(EMS_ID) %>%
 summarise(max_date = max(COLLECTION_START))
collect(result)

disconnect_historic_db(con)

## End(Not run)

bcgov/rems documentation built on Oct. 14, 2023, 3:04 a.m.