Closed etiennebacher closed 1 year ago
I can confirm the issue. The problem is that tabular
isn't recognizing dat$mpg
as a vector of doubles, because haven
put class "labelled"
on it. I'm not a haven
user, so I don't know the recommended way to remove that class, but you will need to do that to get it to work. (I tried zap_label()
, but it doesn't work. It leaves the class there. Bug? unclass()
works, but leaves the label attribute. Maybe unclass(zap_label())
?)
If you read the haven::labelled
help page, you'll see that tabular
is not alone in having trouble dealing with labelled objects.
Sorry, this really is a bug in tables
. It doesn't have much to do with haven
: the problem is that deparse(e[[1]])
was two lines long, and the switch()
function wants something that's only one line long. This is easy to fix; a bug fix will soon appear on Github.
Great! FYI this will be useful for modelsummary
users because there's an option to automatically replace variable names by their labels but it doesn't work with All()
due to this issue.
I've now merged the fix into the main. Could you confirm that things are working for you?
Yup, all good, thanks for the quick fix
Hello, thanks for this amazing package!
I have a problem with
tables::tabular()
when I useAll()
in the formula and there's a least one labelled variable in the data: