-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'。 –