Installing R Packages from CRAN and Use them

There are more than 11,000 R packages that are officially available on CRAN (The Comprehensive R Archive Network). These packages can help you do a lot of things ranging from accessing data, transforming and visualizing, building models, etc.

Can we use them in Exploratory?

Yes, absolutely!

Exploratory is a UI for R, which means most of the operations in Exploratory are R operations.

And you can install your favorite R packages from CRAN and run their functions natively all inside Exploratory.

Among many things you can do by installing R packages, I want to introduce 3cool things.

  • Use the R Package to get data
  • Use the R Package to transform data
  • Use the R Package to build machine learning models

Let’s take a look.

1. Use the R Package to Get Data

There is an organization called Bank for International Settlements who hosts the historical interest rates data of all the central banks in the world among many other data sets and updates them periodically.

And conveniently enough, there is an R package literally called BIS from Eric Persson. It provides a function to download that data easily in R!

I have written a post "Importing and Visualizing Central Bank Historical Interest Rates with BIS" to demonstrate:

  • Install BIS Package
  • Write R Script with BIS Package to Download Data
  • Clean Up Data to Convert Text to Date
  • Visualize Data
  • Categorize Numeric Values / Create Bins
  • Handle Missing Values in Chart

2. Use the R Package to transform data

When you have geocoded (longitude and latitude) data you might want to calculate the distance between two locations.

It turned out there is an R package called ‘geosphere’ from Robert J. Hijmans, Ed Williams, and Chris Vennes, which I could use to do just that!

I have written a post "Calculating a distance between two locations with geosphere package" to demonsrate on:

  • Install ‘geosphere’ package
  • Create a Script to add a custom R function to calculate the distance
  • Use it!

3. Use the R Package to build Machine Learning models

In Exploratory, there are many machine learning and statistical model features either through the data wrangling commands or under Analytics view.

But as you know, there are tons of other machine learning and statistical models in the wild that are not provided by Exploratory out of the box.

The good news is that Exploratory provides a framework with which users can define and use custom model functions.

We have written a note to introduce how to build a Support Vector Machine (SVM) prediction model by installing e1071 R package.