RinR is a TIBCO TERR package that enables an analyst to execute Open Source R commands. It is designed for special cases where TERR cannot execute the function directly.

One of those use cases is accessing third party data sources that are not directly supported in Spotfire. By encapsulating data query code into a function, Spotfire gets access to all the data sources for which an R package is available. Since arbitrary data tables and document properties can be passed to a TERR function, this method allows for fully parameterized access to relational, Big Data, and NoSQL sources.

The functionality is similar to parameterized SQL queries currently available in Spotfire and can be combined with dynamic SQL or other Domain Specific Languages. The following TERR function demonstrates access to a Postgres SQL database.

Rversion <- makeREvaluator("R", RHome = "C:/Program Files/R/R-3.1.2")

getQuery <- function(sql) {
  drv <- dbDriver("PostgreSQL")
  con <- dbConnect(drv, dbname = "demo", user = "postgres", 
                   password = "sa", host = "", port = "5432")
  rs <- dbGetQuery(con, sql)
  REvaluator = Rversion,
  data = list(sql = sql)

Other data source that can be accessed this way include:

Here’s an example where RinR was used to extract New York City Motor Vehicle Collision data from a PostgreSQL database:

erik img Spotfire Tips & Tricks: Accessing Third Party Data Sources Using RinR

Next Steps:

  • Try Spotfire and start discovering meaningful insights in your own data.
  • Subscribe to our blog to stay up to date on the latest insights and trends in Big Data and Big Data analytics.

Comments are closed.