genInclusion: Generate inclusion criterion

Description Usage Arguments Details Value See Also Examples

View source: R/genInclusion.R

Description

This function generates a request form containing a list of all unique values of a particular key variable in a dataset selected, based on which users can specify their inclusion criteria for data extraction.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
genInclusion(
  wkdir = getwd(),
  research.folder = NA,
  table_name = NA,
  data.type = NA,
  database = NA,
  key.var = NA,
  key.desc = NA,
  identifier.var = NA,
  count = NA,
  overwrite = TRUE,
  username = NA,
  password = NA
)

Arguments

wkdir

The path to working directory. See initWkdir for details on a working directory.

research.folder

The name of research folder. See initResearchFolder for details on a research folder.

table_name

The name of dataset. File extension must be included if the data is saved as a flat file instead of in a database, e.g., 'data.csv' should be given instead of simply 'data'.

data.type

flat for flat tables and sql fo MySQL database.

database

Name of database. Should be either private or public for flat tables, indicating whether data is stored in public_data or research/[research folder]/private_data, or the actual name of database if extracting data from a database.

key.var

The name of variable based on which inclusion criterion is specified. Vector with multiple elements is not allowed. To have complex inclusion criteria based on multiple variables, generate one request form for each variable.

key.desc

The name of variable(s) that describes key.var, if any. Multiple description variables should be specified as a character vector. Default is NA, where no description variable is selected.

identifier.var

The name(s) of identifier variable(s) of the inclusion criterion. Multiple identifier variables should be specified as a character vector.

count

Whether a count summary should be generated for each of identifier.var, as a logical vector with the same length as identifier.var. Default value is rep(TRUE, length(identifier.var)).

overwrite

Whether to overwrite existing request form. Default is TRUE.

username

User name for accessing database if data.type is not flat. Default is NA for flat tables.

password

Password for accessing database if data.type is not flat. Default is NA for flat tables.

Details

Writes an .xls file with two sheets to public_data_template if lining to database, and to either public_data_template or private_data_template depending on database for flat tables.

The first sheet overall list contains unique values of key variable with description (if key.desc is specfied and exists in the table), remarks and selection. This sheet will be used to specify inclusion criteria for data extraction in later steps.

The second sheet setting list contains detailed information about the database.

Value

Returns the name of inclusion criteria generated. See details.

See Also

genVariable, extract_data

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
# Generate the inclusion criterion from public table `movement_table.txt`
# based on variable `DIAGNOSIS_CD`. `DIAGNOSIS_DESC` and `ICD_VERSION`
# contains detailed description for the key variable.
#
# Unique entries are identified by `PATIENT_NRIC` and `CASE_NO`.
# Unique `DIAGNOSIS_CD` is counted by `PATIENT_NRIC` and `CASE_NO`.
#
genInclusion(wkdir = "Working directory", research.folder = "requestnum001",
             table_name = `movement_table.txt`, data.type = "flat",
             database = "public",
             key.var = "DIAGNOSIS_CD",
             key.desc = c("DIAGNOSIS_DESC", "ICD_VERSION"),
             identifier.var = c("PATIENT_NRIC", "CASE_NO"))

## End(Not run)

biostatUniBS/RDataXMan documentation built on Feb. 2, 2021, 9:41 a.m.