I need to plot a weighted histogram of density rather than frequency. I know that freq = FALSE
is available in hist()
but you can't specify weights. In ggplot2
I can do this:
library(ggplot2)
w <- seq(1,1000)
w <-w/sum(w)
v <- sort(runif(1000))
foo <- data.frame(v, w)
ggplot(foo, aes(v, weight = w)) + geom_histogram()
But where is the equivalent of freq = FALSE
?