Skip to content
Prev 333924 / 398525 Next

plus/minus +/- in factor; not plotmath not expression

On Dec 2, 2013, at 11:22 AM, Jacob Wegelin wrote:

            
snipped code
It is font-_dependent_. It displays fine on a Mac console if that's any help, but it seems you probably already know that. I tested it on a 2.15.3 version of R on a Windows XP machine which probably has the default font settings for that ancient OS and it displayed fine there, too. It really depends on whether the default font for you OS has a glyph in that position in its font table.
That's not entirely true. The links on the ?plotmath page in the "Other symbols" section send you to ?points which has very instructive examples. I keep an annotated version of the output of TestChars(font=5) on the side of my desktop machine.

TestChars <- function(sign = 1, font = 1, ...)
{
   MB <- l10n_info()$MBCS
   r <- if(font == 5) { sign <- 1; c(32:126, 160:254)
       } else if(MB) 32:126 else 32:255
   if (sign == -1) r <- c(32:126, 160:255)
   par(pty = "s")
   plot(c(-1,16), c(-1,16), type = "n", xlab = "", ylab = "",
        xaxs = "i", yaxs = "i",
        main = sprintf("sign = %d, font = %d", sign, font))
   grid(17, 17, lty = 1) ; mtext(paste("MBCS:", MB))
   for(i in r) try( points(i%%16, i%/%16, pch = sign*i, font = font,...))
   for(i in r) try( text( (i%%16)-0.2, (i%/%16)-0.2,  as.character(i), font = 1, cex=0.5))
}

TestChars(font = 5)

You can see on that graphic that "?" is 177 and:
[1] 177
[1] "b1