Let's say I have a dataset like this
X<-matrix(rnorm(30), nrow=100, ncol=6). I am trying to find a way to apply the sum function to every four rows of column 3. This means I want to sum rows 1-4, rows 4-8 and so on.
Are there any functions such as apply or lapply I could use?