Trouble with plotting

personeelData %>%
filter(!is.na(aanpakkosten)) %>%
group_by(aanpakno, stardatum, gemeentenaam, aanpakomschrijving, aanpakkosten) %>%
summarise(sumPers = sum(personeelskosten)) %>%
group_by(aanpakno, gemeentenaam, aanpakomschrijving) %>%
summarise(totPersK = sum(sumPers), totAanK = sum(aanpakkosten), totKost = sum(totAanK+totPersK)) %>%
arrange(desc(totKost))

This is the code i have used to tidy my data. Now i want to plot it using a geom_col() for every cost type. which are totPersK, totAanK and totKost. I just want them to be stacked upon each other. I can't seem to figure this one out. Maybe someone can help me? I am still learning.

Thanks in advance,
Kevin

Can you post your data? It would be easier to help if we could see exactly what you are working with. Just store the output of the code you posted in some variable, say DF, and the run

dput(DF)

of if the data set is large, run

dput(head(DF))

Post the out put of one of those commands. Please place a line containing only three back ticks, ```, before and after the posted output.

Thanks for your reply, after thinking about it again i used the gather() function to make things easier. So i figured it out. Anyways thank you for your reply.

Have a nice day!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.