View source: R/groupedDataLongToWide.R
groupedDataLongToWide | R Documentation |
This function converts the long format of grouped data into a wide format which is fit to other analytical and plotting packages.
groupedDataLongToWide(
dxDataFile,
idColName,
categoryColName,
dateColName,
reDup = TRUE,
numericOrBinary = B,
count = 1,
selectedCaseFile = NULL
)
dxDataFile |
a |
idColName |
Column name of ID column in dxDataFile. Data type of this argumant should be string without quotation marks. |
dateColName |
Column name of date column in dxDataFile, and the type of date column should be a date format in R or a string format with date information in YYYY/MM/DD or YYYY-MM-DD. Data type of this argumant should be string without quotation marks. |
numericOrBinary |
The wide format data with or without certain diagnostic categories can be marked as binary |
selectedCaseFile |
A data frame with the label of case selected or not. Can be generated by |
The output of this function can be numeric or binary wide format.
A new data.table
based on classified dxDataFile
dataset and converted into a wide format dataset.
# Create a grouped data
ELIX <- icdDxToComorbid(dxDataFile = sampleDxFile,
idColName = ID,
icdColName = ICD,
dateColName = Date,
icd10usingDate = "2015/10/01",
comorbidMethod = elix)
head(ELIX$groupedDT)
# Select case with "Diseases of the urinary system" by level 2 of CCS classification
selectedCaseFile <- selectCases(dxDataFile = sampleDxFile,
idColName = ID,
icdColName = ICD,
dateColName = Date,
icdVerColName = NULL,
icd10usingDate = "2015/10/01",
groupDataType = ccslvl2,
caseCondition = "Diseases of the urinary system",
caseCount = 1)
# Convert the long format of grouped data into a wide binary format with selected case
groupedDataWide <- groupedDataLongToWide(ELIX$groupedDT,
idColName = ID,
categoryColName = Comorbidity,
dateColName = Date,
selectedCaseFile = selectedCaseFile)
groupedDataWide
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.