Learn R Programming

emmeans (version 1.10.5)

untidy: Dare to be un-"tidy"!

Description

Users who use emmeans functions as part of a pipeline -- or post-process those results in some other way -- are likely missing some important information.

Arguments

Details

Your best bet is to display the actual results without any post-processing. That's because emmeans and its relatives have their own summary and print methods that display annotations that may be helpful in explaining what you have. If you just pipe the results into the next step, those annotations are stripped away and you never see them. Statistical analysis is not just a workflow; it is a discipline that involves care in interpreting intermediate results, and thinking before moving on.

Examples

Run this code
neur.glm <- glm(Pain ~ Treatment + Sex + Age, family = binomial(),
            data = neuralgia)
            
### The actual results with annotations (e.g. ests are on logit scale):
emmeans(neur.glm, "Treatment")

### Post-processed results lose the annotations
if(requireNamespace("tibble")) {
    emmeans(neur.glm, "Treatment") |> tibble::as_tibble()
}

Run the code above in your browser using DataLab