I am trying to run a Tukey test in order to determine how total income state tax differs across political parties of governor after conducting my ANOVA test. However, when input the Tukey test code it comes up with an error message saying "no applicable method for 'TukeyHSD' applied to an object of class "data.frame"".
I have attached my code would anyone be able to help me with this?
Run preamble
rm(list=ls())
#Install packages
library(tidyverse)
library(kableExtra)
library(ggplot2)
library(psych)
Open dataset
cw2dataset <- read.csv("CW2_Dataset.csv")
Select relevant variables
merged <- cw2dataset %>% dplyr::select(aiinct, govparty_a)
ANOVA test
income_aov <- merged %>% dplyr::filter(govparty_a >= 0 | govparty_a <= 1)
summary(aov(govparty_a ~ aiinct, data = income_aov))
Run a Tukey test
tukey_result <- TukeyHSD(income_aov)