I try to generate yearwise summary statistics as follows:
data %>%
group_by(year) %>%
summarise(mean.abc = mean(abc), mean.def = mean(def), sd.abc = sd(abc), sd.def = sd(def))
This code returns a row vector filled with NA in the respective columns
mean.abc mean.def sd.abc sd.def
1 NA NA NA NA
So, I tried to work this out and replicated some examples
data(mtcars)
mtcars %>%
group_by(cyl) %>%
summarise(mean = mean(disp))
And this script returns
mean
1 230.7219
So, what am I doing wrong? I am loading the following packages:
loadpackage( c("foreign","haven", "tidyverse", "plyr", "stringr", "eeptools", "factoextra") )
Thanky for your support!