[R] cumulative frequency distribution plot

Gijsbert Stoet stoet at volition.wustl.edu
Wed Jun 25 14:58:19 CEST 2003


To plot a cumulative distribution of, say a behaviorial reaction time
vector, I wrote the following function:

cumhist = function(x)
{
  Z = hist( x , plot=F )
  plot(1:length(Z$counts),cumsum(Z$counts)/length(x)*100,type="b",axes=F,
       ylab="%",xlab="")
  axis(1,at=1:length(Z$counts),labels=round(1/Z$mids,digits=0))
  axis(2)
}

x must be a vector of the data.




More information about the R-help mailing list