在此处输入图像描述我想在我的情节中添加百分比,但我不知道我的问题是什么,这是我的代码:
install.packages("ggmosaic")
library(ggmosaic)
library(tidyr)
library(dplyr)
library(ggplot2)
library(vcd)
M = as.table(as.matrix(healthcare[,-1]))
View(M)
names(dimnames(M)) = c("ever married","work type")
labs <- round(prop.table(M))
mosaic(M, pop = FALSE)
labeling_cells(text = labs, margin = 0)(M)
a<-c("blue","red")