[R] strange behavior of intToUtf8() and text()

Carl Witthoft carl at witthoft.com
Thu Mar 6 23:16:35 CET 2014


As posted to Stack Overflow,
please try this out:

plot(1:10,t='n')
  text(1,1,c(intToUtf8(c(1,9684))),cex=3)
  text(2,2,c(intToUtf8(c(9684))),cex=3)
  text(3,3,c(intToUtf8(c(9679,9684))),cex=3)
  text(4,4,c(intToUtf8(c(9679))),cex=3)
  text(5,5,c(intToUtf8(c(9685,9684))),cex=3)
  text(6,6,c(intToUtf8(c(9682,9685))),cex=3)
  text(7,7,c(intToUtf8(c(9682,9675))),cex=3)
  text(8,8,c(intToUtf8(c(9682,9682))),cex=3)

In theory, those 9600-series values should be interpreted as "Harvey 
Balls" symbols.  In practice, what gets plotted seems to depend on the 
order of the numbers in the argument to intToUtf8, and varies 
significantly from computer to computer (and from OS to OS).

Any ideas?  (Note, there's an alternative solution posted to SO 
http://stackoverflow.com/questions/22225086/harvey-balls-in-r?lq=1 
which uses the extrafont package to drive points(x,y, pch=[stuff] ) , 
but I'm interested in why the code above is so strange).

thanks
Carl

-- 

Sent from a parallel universe almost, but not entirely,
nothing at all like this one.



More information about the R-help mailing list