由于我需要在函数中使用ggplot2,因此需要非标准评估模式 . 因此,使用 aes_string 和 "price" . 但是,不再定义 ..count..
aes_string
"price"
..count..
ggplot(diamonds, aes_string(x="price", ..count../sum(..count..))) + geom_histogram(binwidth = 500)