genVariable: Generate variable list.

Description Usage Arguments Details Value See Also Examples

View source: R/genVariable.R

Description

This function generates a request form containing a list of variables available in a particular key variable in a dataset selected, based on which users can select variables to extract for data extraction.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
genVariable(
  wkdir = getwd(),
  research.folder = NA,
  table_name = NA,
  data.type = NA,
  database = NA,
  identifier.var = NA,
  omit.var = 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.

identifier.var

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

omit.var

The name(s) of variables in the dataset to exclude from the variable list, if any. identifier.var are automatically excluded from the resulting variable list since they will always be in the extracted data. Multiple omit variables should be specified as a character vector. Default is NA.

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 variable list generated. See details.

See Also

genInclusion, extract_data

Examples

1
2
3
4
5
6
7
8
## Not run: 
genVariable(wkdir = "Working directory", research.folder = "requestnum001",
            table_name = "table_demographic.txt",
            data.type = "flat", database = "public",
            identifier.var = "PATIENT_NRIC",
            omit.var = c("PATIENT_NRIC", "NATIONALITY", "POSTAL_CODE"))

## End(Not run)

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