Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class labelled crashes with Hmisc #374

Closed
mariusbarth opened this issue May 15, 2018 · 3 comments
Closed

Class labelled crashes with Hmisc #374

mariusbarth opened this issue May 15, 2018 · 3 comments

Comments

@mariusbarth
Copy link

Hi guys,

while trying to figure out what is going on in a bug reported by one of our users (crsh/papaja#199), I figured out that using haven and Hmisc together produces nasty errors, see the minimum example below. Given the high popularity of both packages, I was wondering how minimum compatibility of both packages could be maintained.

library(Hmisc)
x <- 1:4
label(x) <- "test123"
library(haven)
x[1:3]
Error: `x` and `labels` must be same type

Here is my session info:

devtools::session_info()
Session info ----------------------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.4.4 (2018-03-15)
 system   x86_64, linux-gnu           
 ui       RStudio (1.1.447)           
 language de_DE                       
 collate  de_DE.UTF-8                 
 tz       Europe/Berlin               
 date     2018-05-15                  

Packages --------------------------------------------------------------------------------------------------------------------
 package      * version  date       source        
 acepack        1.4.1    2016-10-29 CRAN (R 3.4.3)
 backports      1.1.2    2017-12-13 CRAN (R 3.4.3)
 base         * 3.4.4    2018-03-16 local         
 base64enc      0.1-3    2015-07-28 CRAN (R 3.4.3)
 checkmate      1.8.5    2017-10-24 CRAN (R 3.4.3)
 cluster        2.0.7-1  2018-04-09 CRAN (R 3.4.4)
 colorspace     1.3-2    2016-12-14 CRAN (R 3.4.3)
 compiler       3.4.4    2018-03-16 local         
 data.table     1.10.4-3 2017-10-27 CRAN (R 3.4.3)
 datasets     * 3.4.4    2018-03-16 local         
 devtools       1.13.5   2018-02-18 CRAN (R 3.4.3)
 digest         0.6.15   2018-01-28 CRAN (R 3.4.3)
 forcats        0.3.0    2018-02-19 cran (@0.3.0) 
 foreign        0.8-70   2018-04-23 CRAN (R 3.4.4)
 Formula      * 1.2-2    2017-07-10 CRAN (R 3.4.3)
 ggplot2      * 2.2.1    2016-12-30 CRAN (R 3.4.3)
 graphics     * 3.4.4    2018-03-16 local         
 grDevices    * 3.4.4    2018-03-16 local         
 grid           3.4.4    2018-03-16 local         
 gridExtra      2.3      2017-09-09 CRAN (R 3.4.3)
 gtable         0.2.0    2016-02-26 CRAN (R 3.4.3)
 haven        * 1.1.1    2018-01-18 cran (@1.1.1) 
 Hmisc        * 4.1-1    2018-01-03 CRAN (R 3.4.3)
 htmlTable      1.11.2   2018-01-20 CRAN (R 3.4.3)
 htmltools      0.3.6    2017-04-28 CRAN (R 3.4.3)
 htmlwidgets    1.2      2018-04-19 CRAN (R 3.4.4)
 knitr          1.20     2018-02-20 CRAN (R 3.4.3)
 lattice      * 0.20-35  2017-03-25 CRAN (R 3.3.3)
 latticeExtra   0.6-28   2016-02-09 CRAN (R 3.4.3)
 lazyeval       0.2.1    2017-10-29 CRAN (R 3.4.3)
 magrittr       1.5      2014-11-22 CRAN (R 3.4.3)
 Matrix         1.2-14   2018-04-09 CRAN (R 3.4.4)
 memoise        1.1.0    2017-04-21 CRAN (R 3.4.3)
 methods      * 3.4.4    2018-03-16 local         
 munsell        0.4.3    2016-02-13 CRAN (R 3.4.3)
 nnet           7.3-12   2016-02-02 CRAN (R 3.4.0)
 pillar         1.2.1    2018-02-27 CRAN (R 3.4.3)
 plyr           1.8.4    2016-06-08 CRAN (R 3.4.3)
 RColorBrewer   1.1-2    2014-12-07 CRAN (R 3.4.3)
 Rcpp           0.12.16  2018-03-13 CRAN (R 3.4.4)
 rlang          0.2.0    2018-02-20 CRAN (R 3.4.3)
 rpart          4.1-13   2018-02-23 CRAN (R 3.4.3)
 rstudioapi     0.7      2017-09-07 CRAN (R 3.4.3)
 scales         0.5.0    2017-08-24 CRAN (R 3.4.3)
 splines        3.4.4    2018-03-16 local         
 stats        * 3.4.4    2018-03-16 local         
 stringi        1.1.7    2018-03-12 CRAN (R 3.4.4)
 stringr        1.3.0    2018-02-19 CRAN (R 3.4.3)
 survival     * 2.42-3   2018-04-16 CRAN (R 3.4.4)
 tibble         1.4.2    2018-01-22 CRAN (R 3.4.3)
 tools          3.4.4    2018-03-16 local         
 utils        * 3.4.4    2018-03-16 local         
 withr          2.1.2    2018-03-15 CRAN (R 3.4.4)
 yaml           2.1.18   2018-03-08 cran (@2.1.18)
@mariusbarth
Copy link
Author

Hi @hadley,

sorry for bothering again. This is a really pressing issue for us, as it currently starts producing a plethora of bug reports - therefore, do you see a way to change the haven package so that methods for class labelled work well with labelled objects from Hmisc? If you see a way, I would also be willing to contribute/implement the necessary code. So, do you see a way?

@hadley
Copy link
Member

hadley commented May 30, 2018

Duplicate of #329

If you really want to fix this, you just need to rename labelled everywhere in haven to haven_labelled

@hadley hadley closed this as completed May 30, 2018
@lock
Copy link

lock bot commented Nov 26, 2018

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Nov 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants