In RStudio, if/else if/else function is not working. Please review

Viewed 22

I tried multiple types for "if", but seems like it's not working or something. Attaching two snaps here ; Please correct me I'm new to R. I'll be thankful. type1

type2

Attached R Source file

x <- 7
if (x > 0) {
print("x is a positive number")
} else {
print ("x is either a negative number or zero")
}

Changing the value for x is giving the wrong answer, # x <- -7

0 Answers
Related