GEMINI-Medicine / Rgemini

A custom R package that provides a variety of functions to perform data analyses with GEMINI data
https://gemini-medicine.github.io/Rgemini/
Other
3 stars 0 forks source link

[BUG]: comorbidity calculation does not fill NA with 0 properly #65

Closed guoyi-smh closed 8 months ago

guoyi-smh commented 8 months ago

comorbidity_index() does not fill in 0 in the result index score properly when at_admission is set to TRUE. In the following part

  if (at_admission) {
    res <- all_diagnoses %>%
      select(genc_id) %>%
      unique() %>%
      full_join(res, by = c("genc_id" = "genc_id")) %>%
      tidyr::replace_na(list(score = 0))
  }

replace_na(list(score = 0)) should be tidyr::replace_na(list(scores = 0))