[R] How to plot distribution of relative frequncy using ggplot2?

Bert Gunter bgunter.4567 at gmail.com
Sat Feb 25 17:29:32 CET 2017


Is this homework?

(We don't do homework here).

Also, this looks pretty basic. Have you gone through any ggplot
tutorials? -- the web and the Rstudio site have many.


-- Bert


Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Sat, Feb 25, 2017 at 8:21 AM, vod vos <vodvos at zoho.com> wrote:
> Hello everyone,
>
> How to plot distribution of relative frequncy using ggplot2 ? The example figure is in the attachment.
>
> If we have data:
>
> aa<- c(1,5,10,20,50,40,50,60,70,80,90,100,150,200,250,300,350,400,450,500,550,600,650,700,750,800,850,900,950,1000)
>
> bb<- c(8,16,30,24,39,54,40,68,72,62,122,80,181,259,275,380,320,434,479,587,626,648,738,766,793,851,871,957,1001,960)
>
> aabbdiff<- aa-bb
>
> aabb<- data.frame(aa, bb, aabbdiff)
>
> library(ggplot2)
>
> ggplot(aabb, aes(aabbdiff)) + geom_histogram()
>
> The above code line did not show what I want, how to draw the figure like in the attachment?
>
> Thanks.
>
>
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list