Data-Visualization Home work 2

Deimantė Jokšaitė

Task

  1. Data types
  2. Statistcs (mean, min, max, etc. depending on the data types), use box plots and other similar plots to illustrate it
  3. Create basic visualizations of your data
  4. Check for periodicity in your data, show it (if there is no seasonality, show that there is no seasonality)
getwd()
## [1] "C:/Users/skirmantas/OneDrive/Desktop"
setwd("C:/Users/skirmantas/OneDrive/Desktop")
duom <- read.csv2("C:/Users/skirmantas/OneDrive/Desktop/DPP.csv", header = TRUE, sep = ";", dec = ".")
  1. Carat(Weight of Diamond) - Weight of Diamond.
  2. Cut(Quality) - Quality of cut(Fair, Good, Very Good, Premium, Ideal).
  3. Color - Diamond Color(from J -> ‘worst’ to D -> ‘Best’).
  4. Clarity - Measurement of Transparency(how clear the Diamond is) Sequence of clarity ( I1 (worst quality), SI2, SI1, VS2, VS1, VVS2, VVS1, IF(best quality) ).
  5. Table - Width of top of a Diamond.
  6. Price(in US dollars) - Price of Diamond in US dollars.
  7. X(length) - Length of Diamond in mm.
  8. Y(width) - Width of Diamond in mm.
  9. Z(depth) - Depth of Diamond in mm.
  10. Depth - Total depth percentage. It can calculated by a simple formula. Total Depth % = z / mean(x , y) or z * 2 / (x + y).
str(duom)
## 'data.frame':    53940 obs. of  10 variables:
##  $ Carat.Weight.of.Daimond.: num  0.23 0.21 0.23 0.29 0.31 0.24 0.24 0.26 0.22 0.23 ...
##  $ Cut.Quality.            : chr  "Ideal" "Premium" "Good" "Premium" ...
##  $ Color                   : chr  "E" "E" "E" "I" ...
##  $ Clarity                 : chr  "SI2" "SI1" "VS1" "VS2" ...
##  $ Depth                   : num  61.5 59.8 56.9 62.4 63.3 62.8 62.3 61.9 65.1 59.4 ...
##  $ Table                   : num  55 61 65 58 58 57 57 55 61 61 ...
##  $ Price.in.US.dollars.    : int  326 326 327 334 335 336 336 337 337 338 ...
##  $ X.length.               : num  3.95 3.89 4.05 4.2 4.34 3.94 3.95 4.07 3.87 4 ...
##  $ Y.width.                : num  3.98 3.84 4.07 4.23 4.35 3.96 3.98 4.11 3.78 4.05 ...
##  $ Z.Depth.                : num  2.43 2.31 2.31 2.63 2.75 2.48 2.47 2.53 2.49 2.39 ...

Ratio – Carat.Weight, Depth, Table, Price in US, Lenght, Width, Depth

Ordinal – Cut Quality, Color, Clarity

library(ggpubr)
## Įkeliamas reikalingas paketas: ggplot2
 par(mfrow = c(2,2))
 
 boxplot(duom$Price.in.US.dollars. , main = "Price.in.US.dollars.")
 boxplot(duom$Table , main = "Table")
 boxplot(duom$X.length., main = "Lenght")
 boxplot(duom$Y.width. , main = "Width")

 par(mfrow = c(1,3))
 
 boxplot(duom$Carat.Weight.of.Daimond. , main = "Carat.Weight.of.Daimond.")
 boxplot(duom$Z.Depth.  , main = "Depth")
 boxplot(duom$Depth , main = "Depth")

par(mfrow = c(3,1))
 
 plot.ts(duom$Carat.Weight.of.Daimond. , col = "gold",main = "Time series ")
 plot.ts(duom$Z.Depth. , col = "yellow", ylim = c(0,8))
 plot.ts(duom$Depth , col = "blue")

 par(mfrow = c(3,1))
 
 plot.ts(duom$Price.in.US.dollars., col = "brown1")
 plot.ts(duom$Table, col = "yellow")
 plot.ts(duom$X.length., col = "blue3")

 par(mfrow = c(1, 2))
 
 hist(duom$Carat.Weight.of.Daimond, main = " Carat Weight ")
 hist(duom$Z.Depth., main = "Diamond depth ")

 par(mfrow = c(1, 2))
 
 hist(duom$X.length., main = "Diamond Lenght")
 hist(duom$Price.in.US.dollars., main = "Diamond Price")