#' ZJU index
#' a novel model for detecting NAFLD (nonalcoholic fatty liver disease)
#'
#' @param data data
#' @param years years
#' @param Year logical
#' @details
#' ZJU = BMI(kg/m2) + fasting plasma glucose (mmol/L) + TG(mmol/L) +3 × ALT/AST ratio (+2, if female)
#' @return ZJU index
#' @export
#'
attach_ZJU <- function(data,years,Year=FALSE){
years <- data_years(data,years)
d <- attach_HemalBiochemistry(years = years,
fast_glucose2 = 'fast_glucose',
fast_triglyceride2 = 'fast_triglyceride',
Alt = TRUE,Ast = TRUE,
Year = TRUE) |>
attach_bodyMeasure(BMI = TRUE) |>
attach_demo(sex = TRUE)
d$sex <- tolower(d$sex)
d$sex <- ifelse(d$sex=='female',2,0)
d$ratio <- d$Alt/d$Ast * 3
d$ZJU <- rowSums(d[,c("BMI","fast_glucose","fast_triglyceride","ratio","sex")])
d <- d[,c("Year","seqn","ZJU")]
attach_return_data(data,d,Year,join='seqn')
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.