Slip 13 - E) Consider the inbuilt iris dataset i) Create a variable “y” and attach to it the output attribute of the “iris” dataset. ii) Create a barplot to break down your output attribute. iii) Create a density plot matrix for each attribute by class value.

Solution:

data(iris)
dataset<-iris
library(caret)
x<-dataset[,1:4]
y<-dataset[ ,5]
library(dplyr)
library(ggplot2)
dataset %>% ggplot(aes(x=y)) + geom_bar() + labs(x = "Iris Flower Species")
scales<-list(x = list(relation = "free"), y = list(relation = "free"))
featurePlot(x = x, y = y, plot = "density", scales = scales)

Post a Comment

0 Comments