'How to Print Anova with names

I'm doing anova analysis using R, But I'm having trouble printing anova table with names.

Here's the dataset

Here's my output:
Here's my output

I want output to be like this:
I want output to be like this

Sample data

name    cntry   nwspol  polintr
ESS8e02_2   IE  60  3   
ESS8e02_2   IE  30  3   
ESS8e02_2   IE  150 2   
ESS8e02_2   IE  120 3   
ESS8e02_2   IE  60  3   
ESS8e02_2   IE  90  3   
ESS8e02_2   IE  180 2   
ESS8e02_2   IE  140 4   
ESS8e02_2   IE  30  3   
ESS8e02_2   IE  60  2   
ESS8e02_2   IE  120 2   
ESS8e02_2   IE  80  2   
ESS8e02_2   IE  30  2   
ESS8e02_2   IE  10  4   

here's my code:

library(haven)

ESS8IE <- read_sav("ESS8IE.sav")

View(ESS8IE)

head(ESS8IE)

res.aov <- aov(nwspol ~ as.factor(polintr), data = ESS8IE)

TukeyHSD(res.aov)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source