What will be the output of the following R program? [code] y<-0:5 vector(y) y[3][/code]

What will be the output of the following R program?
Code:
        y<-0:5
 	vector(y)
 	y[3]
A. Error in vector(y): invalid ‘mode’ argument
B. 1
C. 4
D. 3
 
Answer: a
Explanation: y is already vector; second line is an invalid argument. The third line will give us the output. When an R vector is printed you will notice that an index for the vector is printed in square brackets
[] on the side.
 

Tìm kiếm

Back
Top