add_to_database: Adds a series of files to a database

View source: R/cprd_import.R

add_to_databaseR Documentation

Adds a series of files to a database

Description

This function can be used to import a CPRD file or files into a SQLite database connection.

Usage

add_to_database(db, files, table_name, dateformat = "%d/%m/%Y",
  yob_origin = 1800, practid = TRUE, filenames = FALSE)

Arguments

db

a database connection object

files

a character vector of filenames to files to be imported

table_name

a name for the table to import to

dateformat

the format that dates are stored in the CPRD data. If this is wrong it won't break but all dates are likely to be NA

yob_origin

value to add yob values to to get actual year of birth (Generally 1800)

practid

logical should practice id variable be constructed from the patient ids?

filenames

logical should the filename be included as a variable?

Details

Will automatically unzip files before calling them in If practid is TRUE, a practid variable is constructed by converting the last 3 digits of the patient id (if supplied) to a numeric. If filenames is TRUE, source data filenames are included as a variable with the filetypes stripped away.


rOpenHealth/rEHR documentation built on Sept. 25, 2024, 5:32 p.m.