6

In R I get the following errors any time I hit View() or data.frame and I do not understand why. It happened suddenly.

> View(Fhat_all)
Error in .External2(C_dataviewer, x, title) : unable to start data viewer
In addition: Warning message:
In View(Fhat_all) : unable to open display

> da <- data.frame(comb[true_comb_RMSE[1],1], comb[true_comb_RMSE[1],2],
comb[true_comb_KS[1],1],comb[true_comb_KS[1],2])
Error in (function (env, objName)  : 
could not find function "object.size"

I checked this other page in Stackoverflow Can't use either View() or edit() functions, getting "Error in .External2(C_dataviewer, x, title) : invalid device" error message but I didn't understand how to fix it. So I hit locale on terminal and got this result:

Last login: Mon Mar 21 16:47:07 on ttys000
MacBook-Pro:~ "username"$ locale
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL=
MacBook-Pro:~ "username"$ LC_CTYPE = C R
-bash: LC_CTYPE: command not found

so I hit LC_CTYPE=C R on the the terminal as by suggestion and tried to view a vector in R, but I got the same error message:

> View(w)
Error in .External2(C_dataviewer, x, title) : unable to start data viewer
In addition: Warning message:
In View(w) : unable to open display

Can you please help me? Thank you.

Community
  • 1
  • 1
Andrew
  • 678
  • 2
  • 9
  • 19
  • 1
    Does [this answer](http://stackoverflow.com/questions/19009308/cant-use-either-view-or-edit-functions-getting-error-in-external2c-data) work for you? – hartshoj Mar 15 '17 at 14:19

4 Answers4

2

I had the same issue. I opened XQuartz and then the View() function worked.

Victoria
  • 37
  • 2
2

Experienced this after updating some packages.

Restart R worked for me (in RStudio: Ctrl+Shift+F10). After that, the error vanished and View worked well again.

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

I had the same error when using the jagsUI package, which masks the View function. Perhaps you have conflicts between packages?

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

Easiest workaround in my case was calling detach("package:jagsUI", unload = TRUE) once I finished using JAGS.

EcologyTom
  • 2,344
  • 2
  • 27
  • 38
  • Don't post same answer on multi pal post.Flagged as duplicate if you think. – 4b0 May 31 '19 at 12:17
  • @Shree I think they are different questions, and neither flagged as duplicate. I came across this question first, resolved my problem and thought to offer a potential solution. I only found the second question later. I think my answer might be helpful for other SO users if they only find one of these. I also note other posters offering the same suggestions on both. – EcologyTom May 31 '19 at 13:06
1

Delete the view(), then it will work!

ruddy simonpour
  • 133
  • 1
  • 1
  • 8