Learn R Programming

rEHR (version 1.0)

temp_table: Creates a temporary table in the database

Description

This function is useful if most of your work is on a subset of the database

Usage

temp_table(db, tab_name, select_query)

Arguments

db
a database connection object
tab_name
character name for the teporary table
select_query
character the query that specifies the temporary table

Details

The table will exist for as long as the database connection is kept open The Select_query argument will take the output from a select_events(sql_only = TRUE) based function

Examples

Run this code
## Not run: 
# db <- database("myCPRDdb")
# temp_table(db, tab_name = "post_2005", 
#            select_query = select_events(db, tab = "Referral", 
#                                         columns = c("patid", "eventdate", "medcode"), 
#                                         where = "eventdate > '2005-01-01'",
#                                         sql_only = TRUE))
# ## End(Not run)

Run the code above in your browser using DataLab