Slip 21 - E) Consider the plantGrowth inbuilt dataset i) Create a variable “y” and attach to it the output attribute of the “plantGrowth” 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(PlantGrowth)
dataset<-PlantGrowth 
library(caret)
x<-dataset[,1:1]
y<-dataset[ ,2]
y
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