Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
466 views
in Technique[技术] by (71.8m points)

r - Can't use either View() or edit() functions, getting "Error in .External2(C_dataviewer, x, title) : invalid device" error message

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     
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...