7

I'm running R through the Terminal in a Mac OSX Snow Leopard system.

I get this error message when trying to use View():

Error in .External2(C_dataviewer, x, title) : invalid device In addition: Warning messages: 1: In View(a) : locale not supported by Xlib: some X ops will operate in C locale 2: In View(a) : X cannot set locale modifiers 3: In View(a) : unable to create fontset --fixed-medium-r----120------

And this error message when trying to use edit():

Error in .External2(C_dataentry, datalist, modes) : invalid device In addition: Warning messages: 1: In edit.data.frame(a) : locale not supported by Xlib: some X ops will operate in C locale 2: In edit.data.frame(a) : X cannot set locale modifiers 3: In edit.data.frame(a) : unable to create fontset --fixed-medium-r----120------

I can't find information about this particular problem. What can I do to fix this?

sessionInfo() returns:

R version 3.0.1 (2013-05-16)
Platform: x86_64-apple-darwin10.8.0 (64-bit)

locale:
[1] C/UTF-8/C/C/C/C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     
Cyrus Mohammadian
  • 4,982
  • 6
  • 33
  • 62
NPN328
  • 1,863
  • 3
  • 27
  • 47
  • What does sessionInfo() say? IS this relevant? http://stackoverflow.com/questions/8808069/r-could-not-find-any-x11-fonts-error – doctorlove Sep 25 '13 at 15:48
  • @doctorlove I don't think it's relevant. His error message is regarding fonts and mine is regarding "invalid device". I'll add the sessionInfo() to the original post. – NPN328 Sep 25 '13 at 15:54
  • I'm pretty sure the problem is the unable to create fontset. I can't reproduce this on my Snow Leopard box, but am continuing to research. – Alan Shutko Sep 25 '13 at 16:44
  • Could you try to run xterm from the same prompt? – Alan Shutko Sep 25 '13 at 16:55
  • @AlanShutko If I modify .bashrc (or .profile) as suggested, the error message disappears but View() and edit() calls do nothing, R becomes unresponsive. – NPN328 Sep 25 '13 at 18:40
  • @AlanShutko Nothing happens when i run xterm. Terminal just becomes unresponsive. That kind of unresponsive when ^H appears when you hit the delete key. – NPN328 Sep 25 '13 at 18:50
  • @AlanShutko I reinstalled XQuarts, and now xterm runs from terminal. When I run xterm it opens a new window and a prompt, it also shows this warning message in Terminal: Warning: locale not supported by Xlib, locale set to C – NPN328 Sep 25 '13 at 19:04
  • Ok. The locale warning is benign. If R is still giving the same error, my guess is that you have some configuration that's setting a font that is not on the Mac. (OS X does not seem to bundle the fixed font by default.) Do you perchance have a .Xresources, .Xdefaults, or .xinitrc file in your home directory? – Alan Shutko Sep 25 '13 at 19:09
  • @AlanShutko I have none of those files. – NPN328 Sep 25 '13 at 19:14
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/38053/discussion-between-alan-shutko-and-jcpedroza) – Alan Shutko Sep 25 '13 at 19:14

5 Answers5

3

The problem might be your locale settings. Run command 'locale' from terminal and see if there are any lines with something else but 'C' locale. For example, in my case output is like this:

macbook:foo user$ locale
LANG=
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=

Easiest way to solve this is to set the locale to be C for just the R process ie. run R from terminal session with command 'LC_CTYPE=C R' instead of just 'R'. At least on OS/X 10.6.8 this gets rid of the error messages and allows R to display the edit window.

1

The cause for my problem: View(dataset) in the rchunk where we load up data.

I had it here because I loaded in data like data <-read_excel("name") And had View there because I copied and pasted it from my console, but it's not needed.

Lobo de Colorado
  • 197
  • 2
  • 3
  • 11
1

Experienced this with RStudio Server. I just had to restart R (Ctrl/Cmd + Shift + F10) to get rid of the error.

It was possibly caused by updating some packages.

MS Berends
  • 4,489
  • 1
  • 40
  • 53
1

if you download the xquart, I think you need to restart your Mac to activate its work. I had the same problem just a few minutes ago and I restart my Mac, now it works.

BaiJiawen
  • 11
  • 1
1

I had the same error in RStudio. I'm not certain if this would be the same for using R via the Terminal, but for RStudio users who get this message using the jagsUI package masks the View function which triggers this warning. See this question

Easiest workaround seems to be to call detach("package:jagsUI", unload = TRUE) once you have finished using JAGS.

Check potential conflicts between functions by calling conflicts(detail=TRUE) (Taken from this answer for finding which functions are masked in R).

EcologyTom
  • 2,344
  • 2
  • 27
  • 38