adplus-dvertising
frame-decoration

Question

What will be the output of the following R code?
> x <- 3
> switch(x, 2+2, mean(1:10), rnorm(5))

a.

2.2903605 2.3271663 -0.7060073 1.3622045 -0.2892720

b.

5.5

c.

NULL

d.

Error

Posted under R Programming

Answer: (a).2.2903605 2.3271663 -0.7060073 1.3622045 -0.2892720

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What will be the output of the following R code?