How To Calculate Cusum In R