Professional Documents
Culture Documents
Section E
Reg.no.: 741 to 750
Answer – Option 1
emp.data<-data.frame(
emp_id = c(1:5),
emp_name= c("ram","shyam","mohon","rohon","krishna"),
emp_sal= c(523.90,913.54,641.90,529.0,453.25),
date_app = as.Date(c("2023-01-01","2023-01-02", "2023-01-03","2023-01-
04","2023-01-05")),
stringsAsFactors = FALSE
)
print(emp.data)
Answer - Option 1
f1<-data.frame(emp.data$emp_id,emp.data$emp_name)
PRINT(f1)
Answer – Option 1
Answer – Option 1
f3<-emp.data[3:5,]
PRINT(f3)
Answer – Option 1
f5<-emp.data[c(2,3),c(1,4)]
PRINT(f5)
Answer – Option 3
f7<-emp.data[c(3,3)]
PRINT(f7)
Q7. DISPLLAY THE VALUES AS FOLLOWS FROM THE ABOVE DATA
FRAME
emp_name emp_sal
ram 523.90
shyam 913.54
mohon 641.90
rohon 529.00
krishna 453.25
Answer – Option 1
f7<-emp.data[c(2,3)]
PRINT(f7)
Answer – Option 1
y<-c("Delhi","Pune","Mumbai","Chennai","Kolkata")
cbind(emp.data,Address=y)
x<-list(6,"Manish",1200.00,"2023-01-06")
rbind(emp.data,x)
Answer – Option 1
Answer – Option 1
x <- c(5,7,8,7,2,2,9,4,11,12,9,6)
y <- c(99,86,87,88,111,103,87,94,78,77,85,86)
plot(x, y, main="Observation of Cars", xlab="Car age", ylab="Car speed")
Answer – Option 1
x1 <- c(5,7,8,7,2,2,9,4,11,12,9,6)
y1 <- c(99,86,87,88,111,103,87,94,78,77,85,86)
x2 <- c(2,2,8,1,15,8,12,9,7,3,11,4,7,14,12)
y2 <- c(100,105,84,105,90,99,90,95,94,100,79,112,91,80,85)
plot(x1, y1, main="Observation of Cars", xlab="Car age", ylab="Car speed",
col="red", cex=2)
points(x2, y2, col="blue", cex=2)
Answer – Option 1
x <- c(10,20,30,40)
mylabel <- c("Apples", "Bananas", "Cherries", "Dates")
pie(x, label = mylabel, main = "Fruits")
colors <- c("blue", "yellow", "green", "black")
pie(x, label = mylabel, main = "Fruits", col = colors)
Answer – Option 2
xx <- c(10,20,30,40)
mylabel <- c("Apples", "Bananas", "Cherries", "Dates")
colors <- c("blue", "yellow", "green", "black")
pie(x, label = mylabel, main = "Pie Chart", col = colors)
Answer –
data <- data.frame(id = c(11, 22, 33, 44, 55, 66, 77, 88),
print(data)
Answer – Option 2
Answer – Option 1
Q 19. ##Writing into a CSV File BY COPYING from another CSV file
Answer – Option 1
Q20.
Answer – Option 1