tenancy <- main_tenant%>%
group_by(`Tenancy Type`)%>%
summarise(num = length(`Tenancy Type`),
total = sum(`Number of Works Order`))
I'm trying to get this code to count the amount of different Tenancy Types and for each one sum up the number of works orders for each tenancy type. So I want it to output as:
Tenancy Type Num Total
Tenancy1 121 543
Tenancy2 195 323
Tenancy3 1900 5000
And so forth. With the code above the column Num is populated but the column Total all says NA. What am I doing wrong? I thought it was a quite straight forward piece of code!