runehaubo / ordinal

R package ordinal: Regression Models for Ordinal Data
Other
33 stars 12 forks source link

`clm()` issues a warning message about the formula #45

Closed coeusanalytics closed 3 years ago

coeusanalytics commented 3 years ago

Hi @runehaubo,

I believe this issue is similar to the #34 which relates to a warning regarding formula length. However, this is occurring for the ordinal::clm() function instead. Another user has already raised this in #34 but the issue has since been closed.

Due to this warning, it's causing me issues with rendering tables using another package.

Can this function be fixed as well?

Thanks.

See reproducible example below:


# load packages
library(ordinal)
library(dplyr)

# data set
df <- mtcars %>% 
  mutate_all(.funs = ~ factor(.)) %>% 
  mutate(very_very_very_long_variable1 = cyl,
         very_very_very_long_variable2 = vs,
         very_very_very_long_variable3 = gear)

# this produces a warning
clm(formula = very_very_very_long_variable1 ~ very_very_very_long_variable2 + very_very_very_long_variable3,
    data = df)
#> Warning: Using formula(x) is deprecated when x is a character vector of length > 1.
#>   Consider formula(paste(x, collapse = " ")) instead.

# this does not result in a warning
clm(formula = cyl ~ vs + gear,
    data = df)
#> formula: cyl ~ vs + gear
#> data:    df
#> 
#>  link  threshold nobs logLik AIC   niter max.grad cond.H 
#>  logit flexible  32   -15.00 39.99 5(0)  4.85e-07 2.8e+01
#> 
#> Coefficients:
#>    vs1  gear4  gear5 
#> -4.611 -3.180 -3.476 
#> 
#> Threshold coefficients:
#>    4|6    6|8 
#> -5.852 -2.891

Created on 2021-08-17 by the reprex package (v2.0.1)

runehaubo commented 3 years ago

What is your sessionInfo()?

Cheers Rune

tir. 17. aug. 2021 kl. 04.55 skrev Hung Vo @.***>:

Hi @runehaubo https://github.com/runehaubo,

I believe this issue is similar to the #34 https://github.com/runehaubo/ordinal/issues/34 which relates to a warning regarding formula length. However, this is occurring for the ordinal::clm() function instead. Another user has already raised this in

34 https://github.com/runehaubo/ordinal/issues/34 but the issue has

since been closed.

Due to this warning, it's causing me issues with rendering tables using another package.

Can this function be fixed as well?

Thanks.

See reproducible example below:

load packages

library(ordinal) library(dplyr)

data setdf <- mtcars %>%

mutate_all(.funs = ~ factor(.)) %>% mutate(very_very_very_long_variable1 = cyl, very_very_very_long_variable2 = vs, very_very_very_long_variable3 = gear)

this produces a warning

clm(formula = very_very_very_long_variable1 ~ very_very_very_long_variable2 + very_very_very_long_variable3, data = df)#> Warning: Using formula(x) is deprecated when x is a character vector of length > 1.#> Consider formula(paste(x, collapse = " ")) instead.

this does not result in a warning

clm(formula = cyl ~ vs + gear, data = df)#> formula: cyl ~ vs + gear#> data: df#> #> link threshold nobs logLik AIC niter max.grad cond.H #> logit flexible 32 -15.00 39.99 5(0) 4.85e-07 2.8e+01#> #> Coefficients:#> vs1 gear4 gear5 #> -4.611 -3.180 -3.476 #> #> Threshold coefficients:#> 4|6 6|8 #> -5.852 -2.891

Created on 2021-08-17 by the reprex package https://reprex.tidyverse.org (v2.0.1)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/runehaubo/ordinal/issues/45, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHZZLJBLHUF4OAMC3M7XCDT5HFQ3ANCNFSM5CI5KGPA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

coeusanalytics commented 3 years ago

Hi @runehaubo,

Here's my sessionInfo():

> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19043)

Matrix products: default

locale:
[1] LC_COLLATE=English_Australia.1252  LC_CTYPE=English_Australia.1252    LC_MONETARY=English_Australia.1252
[4] LC_NUMERIC=C                       LC_TIME=English_Australia.1252    

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

other attached packages:
[1] dplyr_1.0.7        ordinal_2019.12-10

loaded via a namespace (and not attached):
 [1] pillar_1.6.2        compiler_4.0.3      captioner_2.2.3     tools_4.0.3         digest_0.6.27       evaluate_0.14      
 [7] lattice_0.20-41     lifecycle_1.0.0     tibble_3.0.4        gtable_0.3.0        ucminf_1.1-4        pkgconfig_2.0.3    
[13] rlang_0.4.10        Matrix_1.2-18       gtsummary_1.4.2     DBI_1.1.0           cli_2.5.0           rstudioapi_0.13    
[19] yaml_2.2.1          xfun_0.24           stringr_1.4.0       knitr_1.33          generics_0.1.0      vctrs_0.3.8        
[25] grid_4.0.3          tidyselect_1.1.0    glue_1.4.2          R6_2.5.0            fansi_0.4.1         survival_3.2-7     
[31] rmarkdown_2.9       tidyr_1.1.2         ggplot2_3.3.2       purrr_0.3.4         magrittr_2.0.1      MASS_7.3-53        
[37] scales_1.1.1        ellipsis_0.3.2      htmltools_0.5.1.1   broom.helpers_1.3.0 splines_4.0.3       assertthat_0.2.1   
[43] gt_0.3.1            colorspace_1.4-1    numDeriv_2016.8-1.1 utf8_1.1.4          stringi_1.6.2       munsell_0.5.0      
[49] crayon_1.3.4
runehaubo commented 3 years ago

Try installing the GitHub version of the package- that should fix your problem.

Cheers Rune

tir. 17. aug. 2021 kl. 06.13 skrev Hung Vo @.***>:

Hi @runehaubo https://github.com/runehaubo,

Here's my sessionInfo():

sessionInfo() R version 4.0.3 (2020-10-10) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19043)

Matrix products: default

locale: [1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252 LC_MONETARY=English_Australia.1252 [4] LC_NUMERIC=C LC_TIME=English_Australia.1252

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

other attached packages: [1] dplyr_1.0.7 ordinal_2019.12-10

loaded via a namespace (and not attached): [1] pillar_1.6.2 compiler_4.0.3 captioner_2.2.3 tools_4.0.3 digest_0.6.27 evaluate_0.14 [7] lattice_0.20-41 lifecycle_1.0.0 tibble_3.0.4 gtable_0.3.0 ucminf_1.1-4 pkgconfig_2.0.3 [13] rlang_0.4.10 Matrix_1.2-18 gtsummary_1.4.2 DBI_1.1.0 cli_2.5.0 rstudioapi_0.13 [19] yaml_2.2.1 xfun_0.24 stringr_1.4.0 knitr_1.33 generics_0.1.0 vctrs_0.3.8 [25] grid_4.0.3 tidyselect_1.1.0 glue_1.4.2 R6_2.5.0 fansi_0.4.1 survival_3.2-7 [31] rmarkdown_2.9 tidyr_1.1.2 ggplot2_3.3.2 purrr_0.3.4 magrittr_2.0.1 MASS_7.3-53 [37] scales_1.1.1 ellipsis_0.3.2 htmltools_0.5.1.1 broom.helpers_1.3.0 splines_4.0.3 assertthat_0.2.1 [43] gt_0.3.1 colorspace_1.4-1 numDeriv_2016.8-1.1 utf8_1.1.4 stringi_1.6.2 munsell_0.5.0 [49] crayon_1.3.4

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/runehaubo/ordinal/issues/45#issuecomment-899979702, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHZZLJDHSWUJWNO4N56FV3T5HOXTANCNFSM5CI5KGPA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

coeusanalytics commented 3 years ago

Looks like it has. Thanks @runehaubo.