Background
I'm trying to have a regression equation viabquote in the legend. Using version # 1 (see R code below the picture) of my R code, I get the picture below.
BUT, I need IF b (see R code below the picture) is "negative" THEN the + sign will be removed. To achieve this criteria, I came up with version # 2 (see R code below the picture) of my R code.
Question
I'm wondering how to fix the error in my Version # 2 R code (see R code below the picture)?
Error: unexpected ')' in " bty = "n")"
Version # 1:
plot(1, ty = 'n')
a = .234; b = -.335
legend("center", legend = bquote(bold(Outcome[i] == .(round (a , 2))~ + ~.
(round(b , 2))~"\u00D7"~Predictor[i])), bty = "n")
Version # 2:
legend("center", legend = bquote(bold(Outcome[i] == .(round (a , 2))~
ifelse(.(b > 0), + , "") ~.(round(b , 2))~"\u00D7"~Predictor[i])),
bty = "n")
