我对 R 和使用这个论坛还很陌生,所以对于我的问题缺乏信息和具体性,我深表歉意,但是如何从我的 ridgeline ggplot 图中删除 NA?这是我到目前为止所拥有的,以及指向我的图表图片的链接:
library(ggplot2)
library(ggridges)
library(dplyr)
fpdata_cleaned$teeth_removed1 <- factor(fpdata_cleaned$teeth_removed1 , levels=c("None", "1 to 5", "6 or More", "All"))
p <- ggplot(fpdata_cleaned,
aes(x = sugardrinks,
y = teeth_removed1,
fill = teeth_removed1)) +
geom_density_ridges() +
theme_ridges() +
labs(y="Number of Teeth Removed Due to Gum Disease", x="Number of Sugary Beverages Consumed per Month") +
theme(legend.position = "none")
p + coord_cartesian(xlim = c(0, 160))