I've data set contains 1000s columns and every 7 rows were grouped as group1,group2 and so on.., i trying to get all 0's count* with 2 and all 1's are just count. Finally i also need to get total frequency of both.
group <- c("group1","group2","group3")
col1 <- c(1,0,0,0,1,NaN,1,0,0,0,1,0,0,0,1,NaN,1,0,0,0)
col2 <- c(1,NaN,0,NaN,1,NaN,1,1,0,1,1,NaN,0,NaN,1,NaN,1,1,0,1)
col3 <- c(0,1,NaN,NaN,0,0,0,0,0,1,0,1,NaN,NaN,0,0,0,0,0,1)
expected output is
col1 col2 col3
group1 0.75 0.625 0.9
group2 0.93 0.7 0.8
group3 0.8 0.6 0.92
I would appreciate your to great help, thanks