Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R plot frequency distribution

Tags:

r

How can I plot a frequency distribution in R? I don't want to bin values. I just want to plot frequency for each value. The hist function insists on binning values unless I specify bins manually (really tedious, because I don't know the values in advance).

like image 713
Colonel Panic Avatar asked Mar 10 '26 20:03

Colonel Panic


2 Answers

You could plot the table of your data:

xx<-sample(1:10,100,replace=TRUE)
plot(table(xx))

a histogram

like image 184
BenBarnes Avatar answered Mar 13 '26 09:03

BenBarnes


have you tried s.distri {ade4}? http://pbil.univ-lyon1.fr/ade4/ade4-html/s.distri.html

 library(ade4)
  xy <- cbind.data.frame(x = runif(200,-1,1), y = runif(200,-1,1))
  distri <- data.frame(w1 = rpois(200, xy$x * (xy$x > 0)))
  s.value(xy, distri$w1, cpoi = 1)
like image 39
cianius Avatar answered Mar 13 '26 09:03

cianius



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!