wideTS | R Documentation |
wideTimeSeriesLab
transforms time-series data into wide format.
wideTimeSeriesLab(
labData,
idColName,
labItemColName,
windowColName,
valueColName
)
labData |
a file or dataframe of laboratory test data with at least 4 columns about patient ID, lab item, test value and test date, respectively. |
idColName |
the column name that records patient ID in labData. |
labItemColName |
the column name that records lab item in labData. If lab code is combined by multiple columns, then just simply add |
windowColName |
the column name that records time window sequence in labData. |
After setting desired time window, data can further transform into wide format, which is more suitable for analysis. If lab item code is composed by multiple columns, it will automatically combined as one. And there can only be single value column selected in this step. #'
A new, wide-formatted data.table
.
timeSeriesData <- getTimeSeriesLab(labData = labSample,
idColName = SUBJECT_ID,
labItemColName = ITEMID,
dateColName = CHARTTIME,
valueColName = VALUENUM,
indexDate = first,
gapDate = 360,
completeWindows = TRUE)
imputedData <- imputeTimeSeriesLab(labData = timeSeriesData,
idColName = ID,
labItemColName = ITEMID,
windowColName = Window,
valueColName = Max & Min,
impMethod = mean,
imputeOverallMean=FALSE)
wideTimeSeriesLab(labData = imputedData,
idColName = ID,
labItemColName = ITEMID,
windowColName = Window,
valueColName = Max)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.