An excellent tutorial on how to use the Pairs Trading package in R
I can verify the above code works from end to end. The impressive thing is it is much simpler tha the Matlab version with their webinar. Here you estimate, generate the signal, and perform a backtest. It shows how easy some of these R packages are.