R/mapLOINC.R

Defines functions mapLOINC

Documented in mapLOINC

#' @rdname mapLOINC
#' @export

mapLOINC <- function(labData, labItemColName, mappingTable = NULL){
  labData <- as.data.table(labData)
  mappingTable <- as.data.table(mappingTable)
  labCols <- unlist(strsplit(deparse(substitute(labItemColName))," [+] "))

  mappedData <- merge(labData, mappingTable, by = labCols,
                       all.x = TRUE, allow.cartesian=TRUE)
  mappedData
}
DHLab-TSENG/lab documentation built on Sept. 1, 2023, 9:03 p.m.