I did not test this way, I 'll do it later, I think that df$diffP <- c(NA, NA, diff(df$P,2)) is the best way to compute the difference !! I 'll post the result here -- View this message in context: http://r.789695.n4.nabble.com/data-frame-temporal-complexity-tp4269585p4270256.html Sent from the R help mailing list archive at Nabble.com.