0

I need to use R (3.0.2 from pkgsrc) on a remote server (NetBSD) over a ssh connection with X11 forwarding. plot(1) is generating the expected graphic on my local machine, however R is also returning warnings in my terminal session as below.

> plot(1)
Warning messages:
1: In (function (display = "", width, height, pointsize, gamma, bg,  :
  locale not supported by Xlib: some X ops will operate in C locale
2: In (function (display = "", width, height, pointsize, gamma, bg,  :
  X cannot set locale modifiers

I don't know whether this bodes problems that I may encounter later, but I'd like to get everything set up and configured correctly. Would someone please clarify the meaning of the warnings and explain how to address them?

Edit for more info:

> sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64--netbsd (64-bit)

locale:
[1] C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     
> names(X11Fonts())
[1] "serif"        "sans"         "mono"         "Times"        "Helvetica"   
[6] "CyrTimes"     "CyrHelvetica" "Arial"        "Mincho"  
Gregory
  • 4,147
  • 7
  • 33
  • 44

1 Answers1

0

The errors are saying that the X11 graphics driver does not know what font to use (see this discussion). By default, R installs with the C locale set. For linux, you need to set a UTF-8 locale which is prefixed by the language.

For example, for the English in the US, you would set it to 'en_US.UTF-8'.

Try setting the system locale with the Sys.setlocale command like so:

Sys.setlocale("LC_CTYPE", "en_US.UTF-8")
Sys.setlocale("LC_ALL", "en_US.UTF-8")

This can be done through the .bashrc configuration file like so:

export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8

(source)

Christopher Louden
  • 7,540
  • 2
  • 26
  • 29
  • I'm still getting the same error after setting the system locale as you advised, but this is clearly on the right track. – Gregory Feb 18 '14 at 17:40
  • Try "LC_ALL" instead of "LC_TIME" (copy and paste without reading). – Christopher Louden Feb 18 '14 at 17:41
  • After using both the Sys.setlocale commands you indicated, R can't find any X11 fonts, so the plot renders without text (e.g. scale bars). I'm checking to see whether this is something I need to address in NetBSD/pkgsrc outside of R. – Gregory Feb 18 '14 at 18:03
  • No luck. Still stuck. – Gregory Feb 19 '14 at 19:47