Let's say I want to plot histogram with the following formula (I know it's not the best but it will illustrate the problem):
set.seed(1)
dframe <- data.frame(val=rnorm(50))
p <- ggplot(dframe, aes(x=val, y=..count..))
p + geom_bar()
It works just fine. However let's say that we want for some reason frequencies divided by an earler defined number. My shot would be:
k <- 5
p <- ggplot(dframe, aes(x=val, y=..count../k))
p + geom_bar()
However I get this annoying error:
Error in eval(expr, envir, enclos) : object 'k' not found
Does there exist a way for using both ..count..
-like variables with some predefined ones?