[R] how do i plot this "hist"?

Petr PIKAL petr.pikal at precheza.cz
Tue Nov 9 20:57:36 CET 2010


Hi

r-help-bounces at r-project.org napsal dne 09.11.2010 20:25:09:

> casperyc <casperyc at hotmail.co.uk> 
> Odeslal: r-help-bounces at r-project.org
> 
> 09.11.2010 20:25
> 
> Re: [R] how do i plot this "hist"?
> 
> 
> Hi all,
> 
> Thank you both. The codes work perfectly.
> 
> I now use
> 
> barplot(t(x.m)[-1,], names.arg = x.m[,1])
> 
> to make the 'histogram' plot.
> 
> Now how do I add a dentity line to it?
> like 'superpose' on the graph?
> say if I got a Normal with mean 100 and variance 3...

see ?lines and ?density

> 
> And I can work out the mean and variance
> through their definition, multiple the 'values' and the 'frequencies',
> sum them up and then devid by the total number, ect...
> 
> Is there any codes that can deal with these count data?
> so that I can tell R, ''x.m[,1]" is the frequency and work out the mean, 
sd,
> ect...straightforward?

maybe

mean(rep(x.m[,1], x.m[,2])
var(rep(x.m[,1], x.m[,2])

Regards
Petr


> 
> Thanks!
> 
> casper
> 
> 
> -- 
> View this message in context: 
http://r.789695.n4.nabble.com/how-do-i-plot-
> this-hist-tp3032796p3034959.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> 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