The question is quite old but for future readers that have the same question, I would recommend the package phia. It as a good vignette for code examples.
phia