getTimeSeriesLab | R Documentation |
getTimeSeriesLab
separates original data into multiple time windows, and summarize statistical information.
getTimeSeriesLab(
labData,
idColName,
labItemColName,
dateColName,
valueColName,
indexDate = last,
gapDate = NULL,
completeWindows = TRUE
)
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 |
dateColName |
the column name that records test date in labData. It should be in |
valueColName |
the column name that records test value in labData. Only numeric value is acceptable. |
indexDate |
the specific date that used for cutting time window. It can be first record ( |
gapDate |
desired period (in days) of each window interval. If |
completeWindows |
logical. If |
This function is used for separating lab data into multiple time windows, and it provides overall statistical information: total count, maximun value, minimun value, mean, nearest record to index date of each time window. If indexDate
is first, then it will be the earliest test date among all the lab tests.
A data.table
with statistical summary.
ts<-getTimeSeriesLab(labData = labSample,
idColName = SUBJECT_ID,
labItemColName = ITEMID,
dateColName = CHARTTIME,
valueColName = VALUENUM,
indexDate = last,
gapDate = 360,
completeWindows = TRUE)
head(ts)
head(indexTable)
tsindex<-getTimeSeriesLab(labData = labSample,
idColName = SUBJECT_ID,
labItemColName = ITEMID,
dateColName = CHARTTIME,
valueColName = VALUENUM,
indexDate = indexTable,
gapDate = 360,
completeWindows = TRUE)
head(tsindex)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.