当我的答案是 TRUE 或 FALSE 时,如何使用 ggplot 创建绘图?
这是我的代码:
t.obese<-master1%>%
filter(Income>0,obese==TRUE)%>%
select(Income,obese)
> head(t.obese)
Income obese
1 21600 TRUE
2 4000 TRUE
3 12720 TRUE
4 26772 TRUE
当我尝试创建绘图时,r 告诉我“不知道如何自动为 Have_labelled/vctrs_vctr/double 类型的对象选择比例。默认为连续。Fehler:stat_count() 只能具有 x 或 y 美学。 "
谢谢!
> dput(t.obese[1:10, ])
structure(list(Income = structure(c(1944, 4000, 16000, 19200,
22800, 21600, 18000, 18000, 2000, 18000), label = "Wages,Salary from main job", format.stata = "%42.0g", labels = c(`[-5] in Fragebogenversion nicht enthalten` = -5,
`[-2] trifft nicht zu` = -2), class = c("haven_labelled", "vctrs_vctr",
"double")), obese = c(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
TRUE, TRUE, TRUE)), row.names = c(NA, 10L), class = "data.frame")