harrelfe / Hmisc

Harrell Miscellaneous
Other
205 stars 81 forks source link

Hmisc and haven conflict: class "labelled" #87

Open ewenharrison opened 6 years ago

ewenharrison commented 6 years ago

https://github.com/tidyverse/haven/issues/329

I see a goal is to use haven for imports. There is conflict in class "labelled" as per below, meaning they can't both be used together.

# Simple linear regression
data(mtcars)
lm(mpg~cyl, data=mtcars) # Works as expected

# Add Hmisc::label()
Hmisc::label(mtcars$mpg) = "MPG"

lm(mpg~cyl, data=mtcars) # Works as expected

library(haven)
lm(mpg~cyl, data=mtcars) # Error: `x` and `labels` must be same type