Creating interactive graphics with ggvis

In order to interact with the reports figures, one can create an interactive graphic with ggvis. In this recipe, we demonstrate how to build our first interactive plot from the real estate dataset.

Getting ready

Before starting this recipe, you should download the RealEstate.csv dataset from the following GitHub link:

https://github.com/ywchiu/rcookbook/blob/master/chapter8/RealEstate.csv

How to do it…

Please perform the following steps to create an interactive plot with ggvis:

  1. Install and load the ggvis package:
    > install.packages("ggvis")
    > library(ggvis)
    
  2. Import RealEstate.csv into an R session:
    > house <- read.csv('RealEstate.csv', header=TRUE)
    > str(house)
    'data.frame': 781 obs. of  8 variables:
     $ MLS : int ...

Get R for Data Science Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.