I want to have 2 conditions in my if statement but somehow it doesn't work. Can anyone maybe help me?
this is my data set
I want to check if the prediction (Pred1) is true.
It is true when Pred1 = "bullish" & Price < RealPrice
My code:
df$result <- ifelse(grepl("bullish", df$Pred1, fixed = TRUE) && df$Price < df$RealPrice, "true",ifelse(grepl("bearish", df$Pred1, fixed = TRUE) && df$Price > df$RealPrice, "true"), "false")