I have a dataframe of housing data, but had to make another dataframe where need to sum the housing type depend on where the area of the house, which there are 2 types of houses in 3 different areas.
df <- na.omit(n[, c("matssvaedi", "teg_eign_s_i")])
counts <- df %>%
group_by(matssvaedi, teg_eign_s_i)%>%
summarise(count = n())
df1 <- ggplot(counts, aes(x = matssvaedi, y = count))
df1 + geom_bar(aes(fill = teg_eign_s_i), stat = "identity", position = 'dodge') + geom_text(aes(label = count), color="black",vjust = 0.01, size = 3) + scale_fill_brewer(palette = "Paired") + theme_classic()