Closed Jeanluc63 closed 1 year ago
Hi, the following works for me on a fully up-to-date system and using the CRAN version of {comorbidity}:
library(comorbidity)
pat_dati.long <- data.frame(
codpaz = 100448,
sesso = "F",
ETA = 79,
CLASSI_ETA = "70-79",
PESO = 83,
BMI = NA,
CLASSE_BMI = NA,
pat = c("pat1", "pat2", "pat3", "pat4", "pat5", "pat6"),
ICD = c("71515", "4011", "", "", "", "")
)
comorbidity(
x = pat_dati.long,
id = "codpaz",
code = "ICD",
map = "elixhauser_icd9_quan",
assign0 = TRUE,
labelled = TRUE,
tidy.codes = TRUE
)
#> codpaz chf carit valv pcd pvd hypunc hypc para ond cpd diabunc diabc hypothy
#> 1 100448 0 0 0 0 0 1 0 0 0 0 0 0 0
#> rf ld pud aids lymph metacanc solidtum rheumd coag obes wloss fed blane dane
#> 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#> alcohol drug psycho depre
#> 1 0 0 0 0
library(devtools)
#> Loading required package: usethis
session_info(info = "platform")
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.3.1 (2023-06-16)
#> os macOS Ventura 13.4
#> system x86_64, darwin20
#> ui X11
#> language (EN)
#> collate en_US.UTF-8
#> ctype en_US.UTF-8
#> tz Europe/Stockholm
#> date 2023-06-24
#> pandoc 3.1.3 @ /usr/local/bin/ (via rmarkdown)
#>
#> ──────────────────────────────────────────────────────────────────────────────
Created on 2023-06-24 with reprex v2.0.2
Could you try the code above and see if that works?
Hi, I try your code but it give me the same error:
Error in comorbidity(x = pat_dati.long, id = "codpaz", code = "ICD", map = "elixhauser_icd9_quan", : unused arguments (x = pat_dati.long, id = "codpaz", code = "ICD", map = "elixhauser_icd9_quan", assign0 = TRUE, labelled = TRUE, tidy.codes = TRUE)
> Loading required package: usethis
session_info(info = "platform") ─ Session info ──────────────────────────────────────────────────────────────────── setting value version R version 4.3.1 (2023-06-16 ucrt) os Windows 10 x64 (build 19044) system x86_64, mingw32 ui RStudio language (EN) collate Italian_Italy.utf8 ctype Italian_Italy.utf8 tz Europe/Rome date 2023-06-25 rstudio 2023.06.0+421 Mountain Hydrangea (desktop) pandoc 3.1.1 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown)
Thank you Gianluca
Interesting, can you try clearing your environment and/or restarting your session and try again the previous code?
I clean environment and your code and mine work perfectly. Thank you Best regards Gianluca
Ok, that's great! Will close this issue then, just let me know if you have any other question.
Best wishes,
Alessandro
Hi, I have updated the R software to version 4.3.1 and also the 'comorbidity' package. Unfortunately the 'comorbidity' function doesn't work and produces the following error:
Error in comorbidity(x = pat_dati.long, id = "codpaz", code = "ICD", map = "elixhauser_icd9_quan", : unused arguments (x = pat_dati.long, id = "codpaz", code = "ICD", map = "elixhauser_icd9_quan", assign0 = TRUE, labelled = TRUE, tidy.codes = TRUE).
These are my data (pat_dati.long), and my id (codpaz) and code (ICD) names.
head(pat_dati.long) codpaz sesso ETA CLASSI_ETA PESO BMI CLASSE_BMI prog_sdo pat ICD 1 100448 F 79 70-79 83 NA 16612 pat1 71515 2 100448 F 79 70-79 83 NA 16612 pat2 4011 3 100448 F 79 70-79 83 NA 16612 pat3
4 100448 F 79 70-79 83 NA 16612 pat4
5 100448 F 79 70-79 83 NA 16612 pat5
6 100448 F 79 70-79 83 NA 16612 pat6
Thank you for your attention Gianluca