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!
The objectives of the projects are the following:
A.From a data set implement the functionality.
B. Create an interactive graph using the plotly () function.
C. Publish a page either in Rpubs, GitPages or Neocities where the developed project is observed.
Este ejercicio tiene como objetivo hacer un gráfico usando la función plotly (), asà como también usando un conjunto de datos muy común en RStudio denominado Diamonts que muestra la pureza y calidad de los diamantes.
In total there are 53,930 records with 10 variables, which we show below:
carat: weight of the diamond (0.2–5.01
cut: quality of the cut (Fair, Good, Very Good, Premium, Ideal)
color: diamond colour, from J (worst) to D (best)
clarity: a measurement of how clear the diamond is (I1 (worst), SI2, SI1, VS2, VS1, VVS2, VVS1, IF (best))
depth: total depth percentage = z / mean(x, y) = 2 * z / (x + y) (43–79)
Table: Width of the top of diamonds relative to the widest point (43–95)
price: price in US dollars ($326–$18,823)
x: length in mm (0–10.74)
y: width in mm (0–58.9)
z: depth in mm (0–31.8)
We use a 10X magnifying glass (10x magnification) or a binocular to observe inclusions in a diamond. Once detected, an inclusion is observed by the table or by the crown to determine:
These three factors determine its visibility and are translated by the purity scale.
FLAWLESS (FL): Absence of internal and external defects with 10x magnification.
INTERNALLY FLAWLESS (IF): Absence of inclusions with 10 increases; in practice, a dimension of less than approximately 5 µ. Pure. We can also find these names: 10X magnifying glass or Loupe Clean (LC).
VVS1 - VVS2: Tiny inclusion visible with great difficulty to the 10X magnifying glass.VVS = Very Very Small Inclusion (s).
VS1 - VS2: Very small and hardly visible inclusion to the 10X magnifying glass. VS = Very Small Inclusion (s).
SI1 - SI2 - SI3:Small inclusion easily visible to the 10X loupe, invisible to the naked eye from the side of the crown. Please note that the SI3 classification is not recognized by expert laboratories (GIA, HRD, etc.), but is used by diamond cutters and is listed in the Rapaport. SI = Small Inclusion.
I1:Inclusion very easily visible with 10X magnifying glass, hardly visible to the naked eye from the side of the crown and does not affect brilliance. P1 = Pique 1.
Load and display the data
carat cut color clarity depth table price x y z
<dbl> <ord> <ord> <ord> <dbl> <dbl> <int> <dbl> <dbl> <dbl>
1 0.23 Ideal E SI2 61.5 55 326 3.95 3.98 2.43
2 0.21 Premium E SI1 59.8 61 326 3.89 3.84 2.31
3 0.23 Good E VS1 56.9 65 327 4.05 4.07 2.31
4 0.290 Premium I VS2 62.4 58 334 4.2 4.23 2.63
5 0.31 Good J SI2 63.3 58 335 4.34 4.35 2.75
6 0.24 Very Good J VVS2 62.8 57 336 3.94 3.96 2.48
7 0.24 Very Good I VVS1 62.3 57 336 3.95 3.98 2.47
8 0.26 Very Good H SI1 61.9 55 337 4.07 4.11 2.53
9 0.22 Fair E VS2 65.1 61 337 3.87 3.78 2.49
10 0.23 Very Good H VS1 59.4 61 338 4 4.05 2.39
# ... with 53,930 more rows
### install.packages("ggplot2")
### install.packages("stats")
### install.packages("graphics")
### install.packages("plotly")
library("ggplot2")
library("stats")
library("graphics")
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
data <- with(diamonds, table(cut, clarity))
vis <- plot_ly(diamonds, x = ~cut, y = ~clarity, z = ~data)
vis <- vis %>% add_histogram2d(colorscale = "Blues")
vis
data1 <- with(diamonds, table(price, color))
vis1 <- plot_ly(diamonds, x = ~color, y = ~price, z = ~data1)
vis1 <- vis1 %>% add_histogram2d(colorscale = "Reds")
vis1