How do you use hist() to plot relative frequencies in R?
If I do the following, I will get a density plot, but I want a relative frequency plot:
a <- c(0,0,0,1,1,2)
hist(a, freq=FALSE)
I want to see a histogram with the following relative frequencies:
.5 for 0 to 1,
.33 for 1 to 2,
and .166 for 2 to 3.
you can try using the histogram()
function in lattice
a <- c(0,0,0,1,1,2)
library(lattice)
histogram(a)
defaults to percent.