Sei sulla pagina 1di 5

nsight:

 ggplot(): initializes a ggplot object. It can be used to declare the input data


frame for a graphic and to specify the set of plot aesthetics intended to be
common throughout all subsequent layers unless specifically overridden.
 Argument passed :
 Data: dataset to use for plot. 
 In this the data set passed is diamonds1000512I
 aes():describe how variables in the data are mapped to visual
properties (aesthetics) of geoms.
 Argument passed in aesthetic unction (aes()) were
 X: assigned the values of colour of the diamonds
 Y assigned the values of price of diamonds
 geom_boxplot():function to draw box plot for one continuous and
one discrete
 CONCLUSION
o Result is a box plot having color on x axis and price on y axis
o Box plot is being drawn to see how many percentage of diamond are
having let say “p” price with respect to let say “c1” color
o For example: diamonds having I color 50 % have price less than 600

Code:

Output:
[1] 959 10

Insight:
 diamonds1000512I %>% filter(color == 'D') %>% as.data.frame() ->
diamonds1000512ID
 diamonds1000512I dataset has been passed to filter function
 filter() function find rows/cases where conditions are true
 in filter() function we have passed the condition that is color of
diamonds should be equal to “D”
 This function will get the rows or cases having color equal to “D”.
 Output is than converted to data frame
 # dim(diamonds1000512ID) used to find the dimension of diamonds1000512ID
 CONCLUSION
o Getting the data set with color of diamonds should be equal to “D”
o New dataset diamonds1000512ID has been formed having color equal to “D”.
o Number of diamonds with color equal to “D” are 959 from 6921

Code:

Output:

Insight:

 ggplot(): initializes a ggplot object. It can be used to declare the input data


frame for a graphic and to specify the set of plot aesthetics intended to be
common throughout all subsequent layers unless specifically overridden.
 Argument passed :
 Data: dataset to use for plot. 
 In this the data set passed is diamonds1000512ID
 aes():describe how variables in the data are mapped to visual
properties (aesthetics) of geoms.
 Argument passed in aesthetic unction (aes()) were
 X: assigned the values of clarity of the diamonds
 geom_bar():function to draw bar chart for one discrete variable
 CONCLUSION
o Result is a bar chart having clarity on x axis and count on y axis.
o Bar chart is drawn to see number of diamonds with particular clarity.
o Height of the bar proportional to the number of cases with particular
clarity.
o Example 300 diamonds have clarity “Sl1”

Code:

Output:

Insight:

 ggplot(): initializes a ggplot object. It can be used to declare the input data


frame for a graphic and to specify the set of plot aesthetics intended to be
common throughout all subsequent layers unless specifically overridden.
 Argument passed :
 Data: dataset to use for plot. 
 In this the data set passed is diamonds1000512ID
 aes():describe how variables in the data are mapped to visual
properties (aesthetics) of geoms.
 Argument passed in aesthetic unction (aes()) were
 X: assigned the values of clarity of the diamonds
 Y assigned the values of price of diamonds
 geom_boxplot():function to draw box plot for one continuous and
one discrete variable.
 fill=rainbow(8):argument passed to
geom_boxplot() to fill rainbow color in box plot
 CONCLUSION
o Result is a box plot having clarity on x axis and price on y axis
o Plot have rain bow color filled in it
o Box plot is being drawn to see how many percentage of diamond are
having let say “p” price with respect to let say “c1” clarity
o For example: diamonds having VVS1 clarity 50 % have price less than
900

Code:

Output:
[1] 21 10

Insight:
 diamonds1000512ID %>% filter(clarity == 'VVS1') %>% as.data.frame() ->
diamonds1000512IDVVS1
 diamonds1000512ID dataset has been passed to filter function
 filter() function find rows/cases where conditions are true
 in filter() function we have passed the condition that is clarity of
diamonds should be equal to “VVS1”
 This function will get the rows or cases having clarity equal to
“VVS1”.
 Output is than converted to data frame
 # dim(diamonds1000512IDVVS1) used to find the dimension of
diamonds1000512IDVVS1
 CONCLUSION
o Getting the data set with clarity VVS1
o New dataset diamonds1000512IDVVS1 has been formed having clarity equal
to “VVS”.
o Number of diamonds with clarity equal to “VVS1”. 21 from 959

Code:

Output:

Insight:

 ggplot(): initializes a ggplot object. It can be used to declare the input data


frame for a graphic and to specify the set of plot aesthetics intended to be
common throughout all subsequent layers unless specifically overridden.
 Argument passed :
 Data: dataset to use for plot. 

Potrebbero piacerti anche