Open AJFOWLER opened 3 years ago
I had this same issue with my own dataset that I can't replicate here, but was fixed by wrapping the data.table
object with as.data.frame(...)
in the glm()
call.
> class(df)
[1] "data.table" "data.frame"
# fails with cplot(x, "x1")
x <- glm(y ~ x1 + x2 + x2 + x3, data = df, family = binomial)
# works
x <- glm(y ~ x1 + x2 + x2 + x3, data = as.data.frame(df), family = binomial)
R version 4.0.2 (2020-06-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.7
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] margins_0.3.26 ggplot2_3.3.3 dplyr_1.0.5
loaded via a namespace (and not attached):
[1] Rcpp_1.0.6 pillar_1.6.0 compiler_4.0.2 tools_4.0.2 digest_0.6.27
[6] bit_4.0.4 gtable_0.3.0 evaluate_0.14 lifecycle_1.0.0 tibble_3.1.1
[11] pkgconfig_2.0.3 rlang_0.4.10 cli_2.5.0 DBI_1.1.0 rstudioapi_0.13
[16] curl_4.3 yaml_2.2.1 xfun_0.22 withr_2.4.2 httr_1.4.2
[21] knitr_1.33 generics_0.0.2 vctrs_0.3.8 geohashTools_0.3.1 hms_0.5.3
[26] grid_4.0.2 bit64_4.0.5 tidyselect_1.1.0 fasttime_1.0-2 glue_1.4.2
[31] data.table_1.13.0 R6_2.5.0 fansi_0.4.2 prediction_0.3.14 rmarkdown_2.7
[36] farver_2.1.0 readr_1.3.1 purrr_0.3.4 magrittr_2.0.1 MASS_7.3-51.6
[41] scales_1.1.1 ellipsis_0.3.2 htmltools_0.5.1.1 assertthat_0.2.1 colorspace_2.0-0
[46] labeling_0.4.2 utf8_1.2.1 tinytex_0.31 munsell_0.5.0 RcppSimdJson_0.1.1
[51] crayon_1.4.1
Please specify whether your issue is about:
If you are reporting (1) a bug or (2) a question about code, please supply:
traceback()
run immediately after the error occurssessionInfo()
I've found an odd bug when using data.table:
Put your code here:
I think this should be fixable either by modifying this lapply or perhaps by calling
class(data) <- 'data.frame'
near the top which seems to resolve this issue? Happy to open PR to help.