Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What will be the output of the following R code?
x <- (“a”, “b”)
as.logical(x)

What will be the output of the following R code?
x <- (“a”, “b”)
as.logical(x)
a) a b
b) “a” “b”
c) 1 1
d) Error

Answer: d
Explanation: It is not possible to coerce, so you will get a Warning. Logical creates a logical vector of the specified length. Each element of the vector is equal to FALSE. as.logical attempts to coerce its argument to be of a logical type.

Join The Discussion