data(mtcars)
#dim(mtcars)
#nrow(mtcars)
#ncol(mtcars)
#names(mtcars)
#head(mtcars,5)
#class(mtcars)
#str(mtcars)
#summary(mtcars)
brands = row.names(mtcars)
features = colnames(mtcars)
#features
#Filtering the data based on cyl column = 4
#class(mtcars[,2]) == class(mtcars$cyl)
#with single condition
#mtcars[mtcars[,2] == 4,]
#or
#mtcars[mtcars$cyl == 4,]
#with multiple condition "|" is works as or and "&" works as and.
l1 =mtcars[(mtcars$cyl == 8) | (mtcars$cyl==6),]
length(l1)
# Above work can be done in other ways as well
l2= mtcars[mtcars$cyl %in% c(8,6),]
length(l2)
# we can provide the vector as well while filtering here in above syntax "%in%" works as or
#mtcars[(mtcars$cyl == 4) & (mtcars$gear == 4) & (mtcars$hp < 80) ,c('cyl','gear','hp')]
To embed this project on your website, copy the following code and paste it into your website's HTML: