[R] histogram

Jim Lemon jim at bitwrit.com.au
Mon Sep 15 10:59:46 CEST 2008


Felipe wrote:
> i calculated the density and wanna do something like this
>
> separate in 0-19-29-39-49-59-69-79-99
> and put in these spaces 8 densities .. 0.something
> i have the frequency in % and divided already in 20 or 10 to get the density
>
> i tried and tried..made breaks vector to separate but couldn't put the other
> vector with the frequency density onit directly
>
> anyone know how to do it??
Hi Felipe,
Try this:

library(plotrix)
testdat<-sample(1:100,1000,TRUE)
testfac<-cut(testdat,breaks=seq(0,100,by=10))
library(prettyR)
testdensity<-as.vector(freq(testfac,display.na=FALSE)[[1]])
barp(testdensity/1000,names.arg=names(testdensity),staxx=TRUE)

Jim



More information about the R-help mailing list