Closed norihikorihiko closed 2 years ago
Hi, Thanks for the bug report - I can reproduce the issue with the code below:
library(comorbidity)
set.seed(1)
x <- data.frame(
id = sample(1:15, size = 200, replace = TRUE),
code = sample_diag(200),
stringsAsFactors = FALSE
)
x$id <- as.character(x$id)
comorbidity(x = x, id = "id", code = "code", map = "charlson_icd10_quan", assign0 = FALSE)
#> Error in data.table::setnafill(x = x, type = "const", fill = 0L): 'x' argument must be numeric type, or list/data.table of numeric types
Created on 2022-04-27 by the reprex package (v2.0.1)
I think this is related to this, I'll look into it as soon as possible!
Hi again @norihikorihiko, I think I might have identified and fixed the issue. Could you give it a go by installing from GitHub with:
library(remotes)
remotes::install_github(repo = "ellessenne/comorbidity", ref = "#55")
Thanks,
Alessandro
Hi there @ellessenne,
I am also experiencing this issue and the fix you posted has not resolved it for me. Even using the same sample code you posted above.
Best wishes,
Jamie
Hi @jwallib, Thanks for the feedback. Do you have a reproducible example? What type is your ID column? Thanks,
Alessandro
Apologies @ellessenne it is working now after having restarted my R session. Thanks for the fix,
Best wishes,
Jamie
I see, no worries, and thanks for letting me know!
Hi @ellessenne , I am facing the same issue, even after updating the library to v1.0.2.9000 using:
remotes::install_github(repo = "ellessenne/comorbidity", ref = "#55")
Currently, my data.table looks like this:
And the code chunk is:
comorbidity::comorbidity(
x = x,
id="PatientID",
code="DiagnosisCode",
map="charlson_icd10_quan",
tidy.codes = TRUE,
assign0=FALSE)
Thanks a lot!
HI @vivek-verma202, thanks for reporting this. What is the specific error that you get? Could you provide a reproducible example?
@ellessenne your fix solved this bug for me as well. Thank you!
No worries @cole-johanson, thanks for letting me know!
This patch is now on the latest CRAN version of {comorbidity}.
I got error in ID with following message in version 1.0.2. Former version I could use alphabetical letter in ID column.
Error in data.table::setnafill(x = x, type = "const", fill = 0L) : 'x' argument must be numeric type, or list/data.table of numeric types