GGPLOT is not loading anymore and crashed R Studio - r

R studio was running fine until last week, when suddenly plots are not loading anymore, and R studio crashes when I try to compute a simple plot.
I up- and downgraded the R version and re installed R studio.
Does anyone know a solution?
Thanks a lot!

Based on comments above:
given that this is a fresh R install and X11() and pdf() both work OK, there must be something wrong with your Quartz/XQuartz installation. Besides re-installing, I don't know what to suggest ...
As a workaround, you can use an X11 graphics device almost everywhere you would use a native Quartz graphics device. I don't think it's possible to tell RStudio to use X11 instead of Quartz (you could ask on an RStudio forum, or maybe someone else will have advice here), but you can start every RStudio session by opening a fresh X11 window (X11()), which R will then use for graphics instead of the built-in RStudio/quartz pane.
Not a perfect solution but maybe good enough to let you get some work done for now ... ?

Related

Alternative place to run my R code with more than 1GB RAM over RStudio Cloud

For some reason, my RStudio constantly crashes on start up in my windows laptop and I have an important assignment to be written in R soon. Are there any alternatives to RStudio that I can use to do this? My task takes over 1gb RAM which is just over the RStudio cloud limit hence I am unable to use that too.
I've gotten all the codes written down, just need to put them onto the Rstudio. If anyone wouldn't mind downloading the file, put my code down and send me a screenshot of the output, please let me know!
Thank you
Visual Studio Code
I second the comment that it probably is not Rstudio that causes the problem. But to answer your question:
Visual studio code has an extension for R, that would give you a quite similar experience.
At these links you can read more about the R extension and visual studio code
Edited to link to the most popular R-package.

What is the code for hiding install.packages() in R?

Currently I'm calling for install.packages() every time I'm loading a library in R, since my laptop seems to always giving me an error message if I don't do that, but I'm kinda sure that I've already installed those packages while setting up RStudio. Is there a way for me to enter those install.packages() on top of every RMD file and then hide them? I've heard that some code could do it. Thanks a lot!
You don't need to install a package each time. Simply run library(whateverpackage) and that's it. You can always suppressMessages(library(whateverpackage)) You can see currently loaded packages using sessionInfo()

R 3.4.1 Console Interface Very Slow on Mac

I have upgraded R from 3.3.3 to 3.4.1 and am finding that typing text directly into the R Console quickly becomes very laggy, even when R isn't using a lot of resources. I have observed this behavior running the last couple versions of macos sierra (10.12.6, etc.).
It is notable that R functions are not particularly slow when executed. Most of the time I use Textmate 2 to pass code to the console and the code passed in this fashion runs without delay.
I've done extensive searching, but I haven't found anyone else reporting this problem. I've found this behavior on two different macs: 2013 Macbook 13" and 2017 Macbook 15" and have encountered the same problem.
Is there an easy solution to this problem that I'm missing?
The only answer I have been able to find is to roll back R to version 3.3.3, which is the last version before R began using Clang and GNU Fortran to compile the executable (https://cran.r-project.org/bin/macosx/ for more info).
This is not an optimal solution since I have to go back to previous versions of some packages I use (which is further complicated by the hunt for the right version of problematic dependencies). I have been looking through the r-devel threads and don't see a discussion of this, which surprises me because I know that I can't be the only person dealing with this. I will contact the r-devel folks and will update here if I get any additional info.
Update
The discussion on this question has identified that the issue is with the macos R GUI. Unfortunately, it appears that the R GUI developers are aware of this issue, but it is not being listed as a bug. The developers suggest clearing the console – not a workable solution for me given how quickly the problem crops up.
I have come up with a better solution, though it is kind of odd. I realized that since the problem is with the GUI and not R, you can take an old version of the GUI (they are available from the R macos development page). I was hoping to be able to use GUI version 1.69, but this caused a crash immediately. version 1.68 on the other hand does work.
I installed R 3.4.1 on my computer and then downloaded the binary file for GUI version 1.68 and copied it into my applications folder (you don't have to do this, but if you do, make sure to rename the program because otherwise you will replace R). I think opened R via the GUI and loaded R 3.4.1 on R Mac GUI version 1.68. So far it seems to be working fine, confirming that the problem is indeed in the GUI.
The issue actually appeared long ago (at R3.1.2 release) once the developers started to use a newer version of Xcode (I think they moved from v.5 to v.8 and above). At that time Simon told me that this is Xcode and Apple's problem, so they can't do anything about it. He did however forced the compilation with an older Xcode which "avoided" the issue till R3.4. I presume they can no longer use this work-around.
Possible solution:
Try running: rm(list = ls(all.names = TRUE)) This should remove everything from your R console, including hidden objects.
Then run .rs.restartR(), which will restart R. Hopefully, whatever is clogging up the program will be gone.
Have you tried RStudio? I highly recommend that GUI to work with R.
If you need more speed you should considering using R with modified matrix products. For example, to use R with openBLAS I wrote a tutorial here: http://pacha.hk/2017-07-12_r_and_python_via_homebrew.html

tools:RGUI disappears from globalenv R

I just installed the newest version of R for my OS -- R version 3.1.3 for MAC. The tools:RGUI does not load properly. Half the time, I open R and search() does not include tools:RGUI. The other half of the time, it does appear but then quickly disappears from the global environment. As a result, I cannot use the help function or search for and install packages. My internet connection is fine. Any ideas?
I think I figured out the problem; I had detach() at the start of my code. I do not normally attach data as I have been told it is a bad habit that can lead to problems. They were right. I have deleted all the references to attach and detach and things seem to work fine now.

Change the font in the R gui

Suddenly, today, the font that R uses in its gui window looks like this:
How can I get it to look nice again?
Note:
I do not want to specify fonts in plots.
I'm on a Mac under OS 10.9.5 using R 3.0.2.
Hmm, I don't know what the problem was, but updating R to the most recent version turned on antialiasing again:
As David Arenburg noted in a comment above, the problem might have been caused by remote access: I accessed this laptop from my desktop iMac yesterday to do a backup. Also I'm currently building fonts with FontForge, and the problem might be related to this (unfinished fonts lying around somewhere).
Anyway, the new installation did it (for the moment). If anyone knows how to analyse and solve this problem without installing, please post an answer.

Resources