Re: [R] barplot and cumulative curve using ggplot2 layers

2009-12-10 Thread hadley wickham
Hi Sunita, To get the bars, you want: ggplot(mydata, aes(x = factor(jobno), y = recruits)) + geom_bar() and to add the cumulative sum, first add it to the data: mydata$cum_ recruits <- cumsum(mydata$recruits) and then add another layer: + geom_line(aes(y = cum_recruits, group = 1)) Hadley O

[R] barplot and cumulative curve using ggplot2 layers

2009-12-10 Thread Sunitap22
Hello My dataset is as follows: jobno recruits 1100 18 1200 1 1850 5 2100 190 2789 25 3000 1 .. .. the dataset has 130 rows I want to plot barplot from left side and cumulative curve from ri