只是想知道是否有人可以帮助您完成堆积式的项目。我可以生成一个barplot,但想要向bar添加另一个变量。我有以下数据框:
lease<- c("99", "99", "99", "11", "11", "11", "11", "16", "16")
date<- c("28/03/2018", "28/03/2018", "28/03/2018", "1/05/2014",
"1/05/2014", "1/05/2014", "8/05/2014", "23/02/2018", "23/02/2018")
nonComp<- c(NA, NA, NA, 1, 1, 1, NA, NA, 1)
region<- c("middle", "middle", "middle", "outside", "outside", "outside",
"outside", "inside", "inside")
perform<- data.frame(lease, date, nonComp, region)
str(perform)
perform$nonComp<-as.factor(perform$nonComp)
plot(perform$lease)
这给出了正确的租赁频率的条形图,但是我想将这些租赁的不合规(nonComp)的频率添加为堆叠的条形。因此,我认为我需要根据租赁因子级别对nonComp观测值进行分组,并求和并以某种方式添加到绘图中。任何帮助将不胜感激。