2023-08-12

Objective

  • This project was created as part of the Developing Data Products course of the Coursera Data Science Specialisation.

  • The goal of the project is to create a web page presentation using R Markdown that features a plot created with Plotly, and to host the resulting web page on either GitHub Pages, RPubs, or NeoCities.

A simple way to make sure if the packages are not installed, this method can be implemented.

if (!require(plotly)){
  install.packages("plotly")
  library(plotly)
}

Data set and Visualization

  • A classic diamond data set is used for this presentation.

  • Here we will try to understand how prices of the diamond varies with the carat.

  • Do note there are types of diamond cuts available.

  • A simple scatter plot is enough to answer the above question.

A simple program

  • A simple code chunk where diamonds data set is used to plot.
d <- diamonds[sample(nrow(diamonds), 1000), ]
fig <- plot_ly(
  d, x = ~carat, y = ~price,
  # Hover text:
  text = ~paste("Price: ", price, '$<br>Cut:', cut),
  color = ~cut, size = ~carat
)

Scattering PLot