Hi, May be this helps: dat1<- read.table(text=" ?? P1_prom Nom 1 -6.17 Pt_00187 2 -6.17 Pt_00187 3 -6.17 Pt_00187 4 -6.17 Pt_00187 5 -6.17 Pt_00187 6 -6.17 Pt_01418 7 -5.77 Pt_01418 8 -5.37 Pt_01418 9 -4.97 Pt_01418 10 -4.57 Pt_01418 ",sep="",header=TRUE,stringsAsFactors=FALSE) library(zoo) ?dat1$PT_promMean<-rollmean(dat1$P1_prom,5,fill=NA,align="left") ?dat1 #?? P1_prom????? Nom PT_promMean #1??? -6.17 Pt_00187?????? -6.17 #2??? -6.17 Pt_00187?????? -6.17 #3??? -6.17 Pt_00187?????? -6.09 #4??? -6.17 Pt_00187?????? -5.93 #5??? -6.17 Pt_00187?????? -5.69 #6??? -6.17 Pt_01418?????? -5.37 #7??? -5.77 Pt_01418????????? NA #8??? -5.37 Pt_01418????????? NA #9??? -4.97 Pt_01418????????? NA #10?? -4.57 Pt_01418????????? NA A.K. Hello all, I have a big data frame that looks like this: ? ? ? ? P1_prom Nom 1 -6.17 Pt_00187 2 -6.17 Pt_00187 3 -6.17 Pt_00187 4 -6.17 Pt_00187 5 -6.17 Pt_00187 6 -6.17 Pt_01418 7 -5.77 Pt_01418 8 -5.37 Pt_01418 9 -4.97 Pt_01418 10 -4.57 Pt_01418 - - - 25000 where Nom represents a point in a map, and P1_prom represents the value of an operation we perfomed on each point (note that we performed 5 repetitions for each point, hence, each point has 5 values). What I am trying to do, with no success, is to create a new column, in which each row corresponds to the mean value of P1_prom for each point. So basically what I need the program to do is to write in the first row of the new column the average of the first five values of P1_prom, in the second row the average of the next five values, and so on. Could anybody guide me on how to do this. Thank you very much, Veronica