I have the following data frame
 df
decades marxftext durkftext
1 1970-1979      3009       393
2 1980-1989      3468       469
3 1990-1999      3420       657 
4 2000-2009      3162       700
and I want to draw a barplot where marxftext and durkftext are next to each other
I tried the following
 melt(df,id.vars ='decades')
and got this
  decades  variable value
1 1970-1979 marxftext  3009
2 1980-1989 marxftext  3468
3 1990-1999 marxftext  3420
4 2000-2009 marxftext  3162
5 1970-1979 durkftext   393
6 1980-1989 durkftext   469
7 1990-1999 durkftext   657
8 2000-2009 durkftext   700
how I can I create a side by side bar graph using geom_bar with this?
Sharing a sample here, in case other folks want to improve on it...
df <- data.frame(c("1970-1979", "1980-1989", "1990-1999"), c(3009, 3468, 3420), c(393, 469, 657))
colnames(df) <- c("decades", "marxftext", "durkftext")
require(ggplot2)
require(reshape2)
df <- melt(df, id = "decades")
ggplot() + geom_bar(data = df, aes(x = decades, y = value, fill = variable), position = "dodge", stat = "identity")

Modification requests? Leave a comment and I'll post edits
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With