library(ggplot2)
set.seed(1)
dat = rbind(data.frame('val' = rnorm(100), 'met' = 'Metric1'), data.frame('val' = rt(100, 2), 'met' = 'Metric12'))
ggplot(dat, aes(x = val, y = met, color = met)) + geom_histogram()
但是我遇到了以下错误
Error in `geom_histogram()`:
! Problem while computing stat.
ℹ Error occurred in the 1st layer.
Caused by error in `setup_params()`:
! `stat_bin()` must only have an x or y aesthetic.
Run `rlang::last_trace()` to see where the error occurred.