H Hằng Đoàn New member Sep 20, 2021 #1 What will be the output of the following R code? Code: > y <- "fruit" > switch(y, fruit = "banana", vegetable = "broccoli", "Neither") A. “banana” B. “Neither” C. “broccoli” D. Error
What will be the output of the following R code? Code: > y <- "fruit" > switch(y, fruit = "banana", vegetable = "broccoli", "Neither") A. “banana” B. “Neither” C. “broccoli” D. Error
T Thịnh Võ Member Sep 20, 2021 #2 Answer: a Explanation: If value is a character vector then the element of ‘…’ with a name that exactly matches value is evaluated. Upvote 0 Downvote
Answer: a Explanation: If value is a character vector then the element of ‘…’ with a name that exactly matches value is evaluated.