jaredlander / coefplot

Plotting model coefficients
Other
27 stars 19 forks source link

Error in UseMethod(generic = "extract.coef", object = model) : no applicable method for 'extract.coef' applied to an object of class "c('glm', 'lm')" #15

Open MarcinKosinski opened 7 years ago

MarcinKosinski commented 7 years ago

I am running examples from the extract.coef I get the following error

> data(diamonds)
> library(coefplot)
> mod1 <- lm(price ~ carat + cut + x, data=diamonds)
> mod2 <- glm(price > 10000 ~ carat + cut + x, data=diamonds, family=binomial(link="logit"))
> mod3 <- lm(price ~ carat*cut + x, data=diamonds)
> extract.coef(mod1)
Error in UseMethod(generic = "extract.coef", object = model) : 
  no applicable method for 'extract.coef' applied to an object of class "lm"
> extract.coef(mod2)
Error in UseMethod(generic = "extract.coef", object = model) : 
  no applicable method for 'extract.coef' applied to an object of class "c('glm', 'lm')"
> extract.coef(mod3)
Error in UseMethod(generic = "extract.coef", object = model) : 
  no applicable method for 'extract.coef' applied to an object of class "lm"

below is the session info

> sessionInfo()
R version 3.3.3 (2017-03-06)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

locale:
[1] LC_COLLATE=Polish_Poland.1250  LC_CTYPE=Polish_Poland.1250    LC_MONETARY=Polish_Poland.1250
[4] LC_NUMERIC=C                   LC_TIME=Polish_Poland.1250    

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] coefplot_1.2.4      pROC_1.9.1          tidyr_0.6.1         VennDiagram_1.6.17  futile.logger_1.4.3
 [6] Boruta_5.2.0        ranger_0.7.0        tables_0.8          Hmisc_4.0-2         ggplot2_2.2.1      
[11] Formula_1.2-1       survival_2.40-1     lattice_0.20-34     cluster_2.0.6       stringr_1.2.0      
[16] dplyr_0.5.0         magrittr_1.5        readr_1.1.0        

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.10         RColorBrewer_1.1-2   plyr_1.8.4           futile.options_1.0.0 base64enc_0.1-3     
 [6] tools_3.3.3          rpart_4.1-10         digest_0.6.12        tibble_1.3.0         gtable_0.2.0        
[11] htmlTable_1.9        checkmate_1.8.2      Matrix_1.2-8         DBI_0.6-1            useful_1.2.1        
[16] gridExtra_2.2.1      knitr_1.15.1         htmlwidgets_0.8      hms_0.3              nnet_7.3-12         
[21] data.table_1.10.4    R6_2.2.0             foreign_0.8-67       latticeExtra_0.6-28  reshape2_1.4.2      
[26] lambda.r_1.1.9       scales_0.4.1         backports_1.0.5      htmltools_0.3.5      splines_3.3.3       
[31] assertthat_0.2.0     colorspace_1.3-2     labeling_0.3         stringi_1.1.5        acepack_1.4.1       
[36] lazyeval_0.2.0       munsell_0.4.3