The ggvis package is used to make interactive data visualizations. The fact that it combines shiny’s reactive programming model and dplyr’s grammar of data transformation make it a useful tool for data scientists.
This package may allows us to implement features like interactivity, but on the other hand every interactive ggvis plot must be connected to a running R session.
Before proceeding, please follow our short tutorial.
Look at the examples given and try to understand the logic behind them. Then try to solve the exercises below using R and without looking at the answers. Then check the solutions.
to check your answers.
Create a list which will include the variables “Horsepower” and “MPG.city” of the “Cars93” data set and make a scatterplot. HINT: Use
Add a slider to the scatterplot of Exercise 1 that sets the point size from 10 to 100. HINT: Use
- Work extensively with the ggvis package and its functionality
- Learn what visualizations exist for your specific use case
- And much more
Add a slider to the scatterplot of Exercise 1 that sets the point
opacity from 0 to 1. HINT: Use
Create a histogram of the variable “Horsepower” of the “Cars93” data set. HINT: Use
width and the
center of the histogram bins you just created to 10.
Add 2 sliders to the histogram you just created, one for
width and the other for
center with values from 0 to 10 and set the
step to 1. HINT: Use
Add the labels “Width” and “Center” to the two sliders respectively. HINT: Use
Create a scatterplot of the variables “Horsepower” and “MPG.city” of the “Cars93” dataset with
size = 10 and
opacity = 0.5.
Add to the scatterplot you just created a function which will set the
size with the left and right keyboard controls. HINT: Use
Add interactivity to the scatterplot you just created using a function that shows the value of the “Horsepower” when you “mouseover” a certain point. HINT: Use
Related exercise sets:
R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more…
Source:: R News