What Will Be The Output Of The Following R Codep Pre Langrsplus #504
What will be the output of the following R code?</p> <pre><code class="language-rsplus"> > printmessage2 <- function(x) { + if(is.na(x)) + print("x is a missing value!") + else if(x > 0) + print("x is greater than zero") + else + print("x is less than or equal to zero") + invisible(x) + } > printmessage2(NA) </code></pre>
This multiple choice question (MCQ) is related to the book/course gs gs110 R Language. It can also be found in gs gs110 Control Structures, Functions, Scoping Rules, Loop Functions and Debugging - Debugging - Quiz No.1.
What will be the output of the following R code?
> printmessage2 <- function(x) { + if(is.na(x)) + print("x is a missing value!") + else if(x > 0) + print("x is greater than zero") + else + print("x is less than or equal to zero") + invisible(x) + } > printmessage2(NA)
“x is a missing value!”
“x is greater than zero”
“x is less than or equal to zero”
Error