Skip to content

Instantly share code, notes, and snippets.

@NRBPerdijk
Last active April 30, 2019 13:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NRBPerdijk/446b9d3ba6c1ee37ebac2b88ef8a719d to your computer and use it in GitHub Desktop.
Save NRBPerdijk/446b9d3ba6c1ee37ebac2b88ef8a719d to your computer and use it in GitHub Desktop.
// Remember to always put a call to R in a Try block, because
// R often resorts to throwing RuntimeExceptions.
Try(rMagicWithBindings(path)) match {
case Failure(f) => print(f)
case Success(weatherForecastList) =>
// We get back a WeatherForecastList, which is a wrapper for List[WeatherForecast].
// Now we can work with the results WITHOUT any parsing:
// simply take out the List and do your operations (here we print them one by one).
weatherForecastList.asScalaList.foreach(forecast => println(forecast))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment