Added error handling for missing cran packages.