Clearing R Workspace at Startup? Nothing works - r

When I open R Studio, a previous workspace keeps loading. I have deleted .RData files, updated R, uninstalled and re-installed RStudio, and RStudio still loads the old workspace. RStudio also will not run any R code now, even after uninstalling and re-installing.
Is there a way to do a 'hard reset' of RStudio from the terminal?
UPDATE: I was able to delete hidden .R files through the terminal, but now commands will not run in RStudio.

Related

How to uninstall R and RStudio with all packages, settings and everything else?

I messed up something and there is a problem with tidyverse. Tried to find a solution but spend lots of time without result.
How to uninstall R and RStudio with all packages, settings and everything else on Windows. I tried to uninstall through Windows uninstall menu and after I installed R and RStudio again same packages appeared as they were installed before. How can I erase everything related to R and RStudio so I be able to make a fresh install?
I have further issues with the previous answer. For that reason, I have extended the answer with further steps (which I experienced currently) as below:
Run .libPaths() and save the listed directories shown on the RStudio console. In my case, it looks like:
.libPaths()
"C:/Users/%USERNAME%/Documents/R/win-library/3.6"
"C:/Program Files/R/R-3.6.3/library"
Uninstall R for Windows, RStudio and RTools from Windows "Programs and Features" menu. You might navigate there through: Add or remove programs > App & features > On search box
Delete everything in folders that was shown after running .libPaths() instruction in R to know where R packages are installed.
Therefore, I have manually deleted following files and folders (they remain there after full uninstallation of R, RStudio and RTools) as well:
C:\Users\%USERNAME%\Documents\R\
C:\Users\%USERNAME%\Documents\.Rhistory
C:\Users\%USERNAME%\AppData\Local\Temp > only specific ones mentioned below.
Specific ones can be various files and folders which can be deleted under this directory related with R and RStudio sessions. In my case, Rtmpcx1qAZ, Rtmpk7UXWj, Rscript3d2438240e1, ... are only example files or folder names to give you rough idea.
Delete everything inside those listed folders or completely delete those listed folders as well:
C:\Users\%USERNAME%\AppData\Local\R
C:\Users\%USERNAME%\AppData\Local\rstudio
C:\Users\%USERNAME%\AppData\Local\RStudio-Desktop
C:\Users\%USERNAME%\AppData\Local\r-miniconda
C:\Users\%USERNAME%\AppData\Local\r-reticulate
C:\Users\%USERNAME%\AppData\Local\??? (!!!might be some others in your case!!!)
C:\Users\%USERNAME%\AppData\Roaming\R
C:\Users\%USERNAME%\AppData\Roaming\RStudio
Then you can move on the re-installation side for R as below (after suggested reboot of Windows). In order (please):
Download R for Windows, (download RTools if you need) and RStudio Desktop.
Install R (R for Windows)
Install RTools (if you need)
Install RStudio (RStudio Desktop)
Run .libPaths() and save the two directories shown on the console
Uninstall R and RStudio from Windows "Programs and Features" menu.
Delete everything in folders that was shown after running .libPaths() in R.
Delete everything in c:\Users\%USERNAME%\AppData\Local\RStudio-Desktop\
Install R and after Rstudio.
All packages where deleted and I think all Rstudio settings too.

Rstudio launch error, pointing to wrong location of R

When Rstudio is launched from the Ubuntu launcher, I got an error
"R script path (/usr/lib/R) is a directory rather than a file."
My R is installed in
/usr/bin/R
This is quite strange as everything was fine just few hours ago and I haven't made any change to R or Rstudio.
Question is, how to make Rstudio point to the correct location of R? I'm not able to get inside the Gui, so it has to be done on command line.
Platform :
Rstudio 1.1.442
Ubuntu 16.04
R 3.4.4
EDIT : Completely reinstalled Rstudio, gotten ride of the .rstudio-desktop folder, still the same error.
I put this line in .bashrc, and I'm able to launch it from a terminal,
export RSTUDIO_WHICH_R=/usr/bin/R

RStudio won't start, R ver. 3.4.2, Rstudio ver. 1.1.383

I'm not able to start a fresh installment of RStudio. I've deleted prior versions, and are currently only running R ver. 3.4.2. Likewise I've deleted my .RData file, but nothing seems to work. The program doesn't show anything, but it is listed on running programs, and the more times I click the more times it opens a new RStudio, untill it clogs the CPU. I'm running Windows 10.
What to do?
I am afraid that this idea will help you or not that you can try this.
Uninstalling RStudio and R, cleaning the registry, and installing again.
If it is running then close it first from the task manager then uninstall the program.

Empty "Rplot.pdf" file is created every time Rstudio is started

I'm using Rstudio 1.1.383 and R version 3.4.2 (2017-09-28) on two different Mac OS X machines.
Every time I start Rstudio or I restart the R session from within Rstudio, an empty file named Rplot.pdf is created in the top folder of the current Rstudio project.
I tried re-installing both Rstudio and R with no avail.
What is causing the issue is the effects package (version 4.0.0). If there is a .R file with the line library(effects) in the project folder and I open the project, or if I open an .Rmd file containing that line from within Rstudio, the plot is created (to be sure, the issue is not happening when loading the package).
I downgraded to a previous version and that seems to have solved the problem.

Knitting error when knitting html on RStudio

I've been a regular R user for 1.5 years. Never seen this happen and have no idea how to fix it. I've read the whole Internet in search of a solution without luck. I have tried restarting my computer and reinstalling RStudio. I am able to knit any .Rmd as a .pdf or .html the first time I try it, but subsequent tries fail with the error messages below. This happens with both tried-and-true .Rmd that have worked previously as well as new template .Rmd files created through RStudio's File-->New option. If I re-install RStudio, it allows knitting of any .Rmd file again on the first try.
Loading required package: knitr
Warning message:
package ‘knitr’ was built under R version 3.2.3
processing file: HW16.Rmd
|.................................................................| 100%
ordinary text without R code
output file: HW16.md
[1] "HW16.md"
Error generating HTML preview for ~/Dropbox/MyProjects/spring2016/advancedMachineLearning/HW16.Rmd r error 4 (R code execution error)
The console generates:
I found a solution: delete R from your computer. You do not need to re-install RStudio. To delete R on my Mac, I went to /Library/Frameworks/R.framework/Versions/ then deleted the folders "3.2.x" (these stand for the version of R. It is possible that you have more than one version installed). Next, I re-installed R using brew in the terminal.
brew tap homebrew/science
brew install r
Open RStudio. Knit any .Rmd that is known to work, or a fresh .Rmd generated by RStudio. Knit again. Problem solved!

Resources