observed = n(),
expected = totaln/12,
diff = observed-expected,
sq_diff = diff^2,
std_sq_diff = sq_diff / expected
I am trying to get R to create a tibble for this, but it keeps having errors. First it said that summarise was an ungrouping output and to override with
.groups, but that didn't work so I put ungroup before summary and now it is saying that n() can only be used inside dplyr verbs even though it is in one, summarise. Can someone please help me.