aggregate ngrams R script written