I have a large data set with 48 columns and 481 rows. I need to calculate the mean value of every column, in every 12th row. so cell [12,1] [24,1] etc, then again for column 2.
I havent figured out a simple way of doing it for more that 5 rows at the time
This is how ive done it previously, which isnt optimal, but I cant for the life of me figure out a better way.
# getting the mean of every 96th row (5 rows), then plotting it, and repeat for every column
# modified_c… is the df
for (l in 1:47){
A = c(as.numeric(modified_Candida_albicans_5plates_48h[row,column]))
row = row + 96
B = c(as.numeric(modified_Candida_albicans_5plates_48h[row,column]))
row = row + 96
C = c(as.numeric(modified_Candida_albicans_5plates_48h[row,column]))
row = row + 96
D = c(as.numeric(modified_Candida_albicans_5plates_48h[row,column]))
row = row + 96
E = c(as.numeric(modified_Candida_albicans_5plates_48h[row,column]))
meana = c(A,B,C,D,E)
meanb = mean(meana)
points(time,meanb,pch = 19, col=”blue”)
time = time + 1
column = column + 1
row = row – 384
}
Johannes Dekeyser is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.