JHU Data Products Week 3

Max Mendez L

29/07/2020

Coursera JHU Data Science Specialization, Developing Data Products, Week 3 Assignment. Objective: Create a web page presentation using R Markdown that features a plot created with Plotly. Host your webpage on either GitHub Pages, RPubs, or NeoCities. Your webpage must contain the date that you created the document, and it must contain a plot created with Plotly. We would love to see you show off your creativity!

Load and Manipulation of Data

## Warning: package 'dplyr' was built under R version 3.5.2
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union

Define our variables

##                cyl
## lkm_categorised  4  6  8
##         average  0  0  7
##         good    11  7  5
##         poor     0  0  2

Here we see fuel consumption (L/100km) as a function of weight (lb) ad the size represents a category where the cars categorized by their cyl in 3 groups. Red line shows the linear relationship between weight and fuel consumption.

library(plotly)
## Loading required package: ggplot2
## Warning: package 'ggplot2' was built under R version 3.5.2
## 
## 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
plot_ly(data, y= wt, x=~lkm) %>%  add_markers(y=~wt, size = hp, color=lkm_categorised) %>% add_lines(x=~lkm, y=fitted(lm)) 
## Warning: `line.width` does not currently support multiple values.
## Warning: `line.width` does not currently support multiple values.

## Warning: `line.width` does not currently support multiple values.

***