1/19/2021

Data loading and processing

library(ggplot2)
library(plotly)
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
mtcars$cyl <- factor(mtcars$cyl)
levels(mtcars$cyl) <- c("cyl4", "cyl6", "cyl8")
levels(mtcars$cyl)
p <- ggplot(data = mtcars, aes(x = wt, y = mpg)) +
  geom_point(size = mtcars$gear, color = mtcars$hp) +
  geom_smooth(method = "glm") +
  facet_grid(.~ cyl, labeller =) +
  labs(title = "Relationship between wt and mpg from mtcars dataset")
gg <- ggplotly(p)
## `geom_smooth()` using formula 'y ~ x'

Relationship between mpg and selected variables from mtcars