added R script for first order markov chains