Skip to content
This repository has been archived by the owner on Aug 23, 2022. It is now read-only.

Long2short #145

Merged
merged 4 commits into from
Nov 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export(is.drugs)
export(is.laboratory)
export(is.physiology)
export(lenstay)
export(long2stname)
export(lookup.items)
export(new.episode)
export(physio.distribution)
Expand Down
12 changes: 12 additions & 0 deletions R/stdid.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,18 @@ stname2longname <- function(stname) {
return(code)
}

#' Convert long names to short names.
#'
#' @param l long name such as "heart rate"
#' @return short name character such as "h_rate"
#' @export
long2stname <- function(l) {
l <- as.character(l)
s <- long2stname.dict[l]
s[is.na(s)] <- l[is.na(s)]
return(s)
}


#' Identify the classification - classification1
#'
Expand Down
2 changes: 2 additions & 0 deletions R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
longnames <- sapply(ITEM_REF, function(x) x$dataItem)
stname2longname.dict <- longnames
names(stname2longname.dict) <- stname
long2stname.dict <- reverse.name.value(stname2longname.dict)

#' classification dictionary: demographic, nurse, physiology, laboratory, drugs
class.dict_code <- sapply(ITEM_REF, function(x) x$Classification1)
Expand All @@ -50,6 +51,7 @@
assign("code2stname.dict" , code2stname.dict , envir=env)
assign("stname2code.dict" , stname2code.dict , envir=env)
assign("stname2longname.dict" , stname2longname.dict , envir=env)
assign("long2stname.dict" , long2stname.dict , envir=env)
assign("class.dict_code" , class.dict_code , envir=env)
assign("class.dict_stname", class.dict_stname, envir=env)
assign("tval.dict_code" , tval.dict_code , envir=env)
Expand Down
4 changes: 2 additions & 2 deletions man/lenstay.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions man/long2stname.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.