#Assignment 2 #Create Following Vector, Data frame 3x4
a<-c(2,5,6,7)
b<-c(1,0,9,8)
c<-c(6,5,8,3)
data1 <- data.frame(a, b, c)
rbind(data1)
## a b c
## 1 2 1 6
## 2 5 0 5
## 3 6 9 8
## 4 7 8 3
#Naming Columns and Row
colnames(data1) <- c("Present","Absent","On Leave")
rownames(data1) <-c("Mon","Tue","Wed","Thu")
print(data1)
## Present Absent On Leave
## Mon 2 1 6
## Tue 5 0 5
## Wed 6 9 8
## Thu 7 8 3
#Sum of Row and Coloumn
rowSums(data1); colSums(data1)
## Mon Tue Wed Thu
## 9 10 23 18
## Present Absent On Leave
## 20 18 22
#Data Set mtcars scatterplot, Boxplot and Hsitogram
cardata <- mtcars
View(cardata)
#Box Plot
boxplot(cardata$mpg~cardata$gear,col='Blue')
#Histogram
hist(cardata$disp, breaks=6, col='Blue')
#Scatterplot
plot(cardata$mpg~cardata$disp, col='Blue')