News Pin

The following chunks creates a list with the latest world news from the BBC:

library(xml2)

world_news <- data.frame(
  title = xml_text(
    xml_find_all(
      read_xml("http://feeds.bbci.co.uk/news/rss.xml"),
      "///item/title/node()"
    )
  )
)

We can then run this under RStudio Connecet on, say, a daily schedule; for this to work, you first need to register the rstudio:

pins::board_register("rstudio")

And then create pins as usual,

pins::pin(world_news, "worldnews", board = "rstudio")

We can then access this pin with ease using a relative path worldnews/. You can then copy-paste the URL and retrieve the pin in your own R session using pins:

pins::pin_get("https://beta.rstudioconnect.com/content/5390/worldnews", board = "rstudio")

You can also skip the parts from the URL which the pins package can guess for you:

pins::pin_get("5390/worldnews", board = "rstudio")


javierluraschi/pins documentation built on July 15, 2019, 1:21 p.m.