October 6, 2018

Data Processing

Simple plot where we manipulate the row names to get a "category (make)" for each of the cars, and then use this to aggregate information about their MPG.

data<-(mtcars)
split<-regexpr(row.names(data),pattern=c("\\s"))
split[split==-1]<-length(row.names(data[split==-1]))
data$type<-substr(row.names(data),start=1,stop=split)

Interactive Plot

plot_ly(data,x=~mpg,y=~type,color=~as.factor(cyl),type="box")