I'm trying to plot a histogram for a dataframe in R. I'm using the Hmisc package to do the same. It generates a very nice plot for categorical data except for one problem. It displays the frequencies instead of probabilities. Please find a code sample (from the package documentation, although my data is categorical but that doesn't matter) below:
x <- rnorm(200,0,2)+1; y <- x^2
x2 <- round((x+rnorm(200))/2)*2
x3 <- round((x+rnorm(200))/4)*4
dfram <- data.frame(y,x,x2,x3)
hist(dfram)
How do I modify the plot above to display normalised frequencies?
I have already tried hist(dfram, type='density')
but type ='density'
is an argument to histSpike function to plot kernel densities. I have also tried hist(dfram,f=F)
and hist(dfram,prob=T)
(which are essentially the same from what I understand) but the histograms still show frequencies.