I was wondering why summarise() is returning a table, while I was expecting a row?
Here's the code:
car %>% group_by() %>%
mutate(grandmean = mean(Puntuacion, na.rm = TRUE)) %>%
mutate(SST1 = sum ((Puntuacion - grandmean)^2)) %>%
group_by(Tipo_vehiculo) %>%
mutate(groupmean = mean(Puntuacion, na.rm = TRUE)) %>%
mutate(vec_sum = ((Puntuacion - groupmean)^2)) %>%
group_by() %>%
mutate(SSW1 = sum(vec_sum)) %>%
mutate(SSB1 = SST1 - SSW1) %>%
summarise(SST2 = SST1, SSB2 = SSB1, SSW2 = SSW1, F = (SSB1 / (m-1)) / (SSW1/ (n-m)))
Thanks for your help!
** even though Im still not sure how to properly solve it, i solved it adding:
%>% summarise(SST = SST2[1], SSB = SSB2[1], SSW = SSW2[1], F_value = F[1])
question from:
https://stackoverflow.com/questions/65851713/dplyr-summarise 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…