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.

1

4 Answers 4

2

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

0
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.

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.

2
  • Don't post same answer on multi pal post.Flagged as duplicate if you think.
    – 4b0
    May 31, 2019 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, 2019 at 13:06
1

Delete the view(), then it will work!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.