#Question 2(a)

x <- c(-5, 8, -10, 15, 20, -2)

ifelse(x > 0, "Positive", "Negative")
## [1] "Negative" "Positive" "Negative" "Positive" "Positive" "Negative"

#Question 2(b)

x <- c("A","b","C","d","E","f")

ifelse(x == toupper(x),
       "Uppercase",
       "Lowercase")
## [1] "Uppercase" "Lowercase" "Uppercase" "Lowercase" "Uppercase" "Lowercase"

#Question 2(c)

x <- c(10,20,30,40,50)
y <- c(10,15,35,40,45)

ifelse(x > y,
       "Larger",
       ifelse(x < y,
              "Smaller",
              "Equal"))
## [1] "Equal"   "Larger"  "Smaller" "Equal"   "Larger"