Created a windowFunction to analyse the data.