[R-SIG-Mac] legend function and Inf warnings

Ossenbruggen, Paul P@ul@O@@enbruggen @ending from unh@edu
Sat Oct 20 17:23:31 CEST 2018


	I receive warnings() that make debugging difficult. I have two questions:

1. In this part of my script, I want my script to return “Inf”. I receive the following warning.

In min(df12.[df12.[, 7] <= 0, 1]) :
  no non-missing arguments to min; returning Inf

Is there are command to eliminate the warning message?

2. I use the following legend that returns a plot that I am happy with and no errors:

legend("topright",
             title = "",
             legend = c(
               expression("Predictions:"),
               bquote(bar(u)[A] == .(u.a)),
               bquote(bar(u)[D] == .(u.d))
             ),
             cex = c(0.75,0.75,0.75)
             )

At the same time, I receive the following warnings:

warnings()
Warning messages:
1: In if (xc < 0) text.width <- -text.width :
  the condition has length > 1 and only the first element will be used
2: In strheight(legend, units = "user", cex = cex)/yc :
  longer object length is not a multiple of shorter object length
3: In w0 * rep.int(0:(ncol - 1), rep.int(n.legpercol, ncol)) :
  longer object length is not a multiple of shorter object length
4: In left + xchar + xextra + (w0 * rep.int(0:(ncol - 1),  ... :
  longer object length is not a multiple of shorter object length
5: In (rep.int(1L:n.legpercol, ncol)[1L:n.leg] - 1 + !is.null(title)) *  ... :
  longer object length is not a multiple of shorter object length
6: In top - 0.5 * yextra - ymax - (rep.int(1L:n.legpercol,  ... :
  longer object length is not a multiple of shorter object length
7: In xt + x.intersp * xchar :
  longer object length is not a multiple of shorter object length
8: In if (xc < 0) text.width <- -text.width :
  the condition has length > 1 and only the first element will be used
9: In if (xc < 0) text.width <- -text.width :
  the condition has length > 1 and only the first element will be used

If I remove “bquote” from “legend,” no warnings are produced. 

By the way, “xc,” “yextra”, and other variable listed are not part of my script. I have no idea what to do with the warning information.

Is there a better way to write my “legend” code?

Thanks,
Paul







More information about the R-SIG-Mac mailing list