-1
我正在使用下面的代码按月分组来计算总和或计数。但是,SLARespond列似乎是整个数据集的总和,而不是每个月。如何按月累加或计数R?
任何我能解决问题的方法? 也可以,而不是总和功能,我可以做计数功能与SLAIncident $ IsSlaRespondByViolated == 1
欣赏的帮助!
SLAIncident <- SLAIncident %>%
mutate(month = format(SLAIncident$CreatedDateLocal, "%m"), year = format(SLAIncident$CreatedDateLocal, "%Y")) %>%
group_by(year, month) %>%
summarise(SLARespond = sum(SLAIncident$IsSlaRespondByViolated))
不要使用'SLAIncident $ CreatedDateLocal',而不是在所有变量中使用'CreatedDateLocal'和类似的。 – lmo
并将'SLAIncident $ IsSlaRespondByViolated'改为'IsSlaRespondByViolated'。 –