Creating an R dashboard
In this section, we create a dashboard in an R Notebook.
How to do it...
We have the following script; it loads and analyzes the data, producing four graphical elements. They are the head of the dataset, regression analysis, comparing sales components as drivers to sales, and comparing ad effectiveness:
# Load and display same of the data points
#install.packages("s20x", repos='http://cran.us.r-project.org')
#install.packages("car", repos='http://cran.us.r-project.org')
# libraries used
library(s20x)
library(car)
# load and display data - originally at http://www.dataapple.net/wp-content/uploads/2013/04/
df <- read.csv("grapeJuice.csv",header=T)
head(df)
# Calculate ad effectiveness # #divide the dataset into two sub dataset by ad_type sales_ad_nature = subset(df,ad_type==0) sales_ad_family = subset(df,ad_type==1) # graph the two par(mfrow = c(1,2)) hist(sales_ad_nature$sales,main="",xlab="sales with nature production theme ad",prob=T) lines(density...