Question:

What will be the output of the below code -

Answer:

printmessage <- function (a) {

                  if (is.na (a))

                             print ("a is a missing value!")

                     else if (a < 0)

                             print ("a is less than zero")

                     else

                            print ("a is greater than or equal to zero")

                    invisible (a)

 }

printmessage (NA)

The output for the above R programming code will be “a is a missing value.” The function is.na () is used to check if the input passed is a missing value.


Keywords:

© 2017 QuizBucket.org