I hope my title isn't misleading, unsure how to word this properly.
I have three datasets (BL, BM, BH) with identical columnheaders (7) and rownumbers (1-2412), like this:
This code
ggplot(BL[1334:2413,])+
geom_step(size=c(2), color = "black",na.rm=TRUE)+
geom_step(data=BM[1334:2413,], size=c(2), color = "grey",na.rm=TRUE)+
geom_step(data=BH[1334:2413,], size=c(2), color = "white",na.rm=TRUE)+
aes(x = timestep, y = cumsum(HarvWood..g.m2.))+
labs(x="År",y="Avverkning")+
ylim(0,35000)+
theme_dark()+
xlim(2010,2110)+
ggtitle("Avverkning (kumulativ)")
it creates this graph
How do I create a new graph with the three dataframes on x and the sum of HarvWood..g.m2. on y? Note I only include rows [1334:2413] in all three of them.
Edit: Here are the three files that I am working with. https://www.dropbox.com/sh/w2l9ulvyfrn7rs0/AACKq3mXpmf2zLhS5JgFjUOYa?dl=0
Edit2: I guess I solved it, but only after manually putting the sums into a new df (sum.harv), and then making a barplot out of that.
colSums(BL, na.rm=TRUE)
colSums(BM, na.rm=TRUE)
colSums(BH, na.rm=TRUE)
#sum.harv
Scenario Harvwood
BL 70716
BM 78808
BH 81248
ggplot(sum.harv)+
geom_bar(aes(x=Scenario,y=Harvwood, color = Scenario),stat="identity")
Any faster/fancier way of doing it?