Hidden Markov Models for Time Series: An Introduction Using R