Updated question with more details:
I am not able to open my R workspace, and getting the following error (in base R, RStudio simply shows the first line of error and then freezes):
Error: value of 'SET_ATTRIB' must be a pairlist or NULL, not a 'list'
During startup - Warning message:
unable to restore saved data in C:\R_Library\A\.RData
Other R Workspaces are loading so definitely it is a corrupt .RData file issue. The R Workspace is half a GB in size. I am working on a Windows machine (64-bit) with R version 3.1.2.
My R was running slow, and I decided to save my Workspace and relaod the image. That's when the error message started. It could be due to large data in the environment, but I have handled more data before without any issues.
There is no information available on how to fix this issue. I have some unsaved code in the directory, which is the bare minimum I would want to recover. Any advice will be useful.
Try renaming the file .RData in your R working directory. Start R, and run
load("whatever you renamed .RData to").
If this still does not work, try clicking on your renamed R project file. It should open your workspace with an empty environment.
Related
I've been looking through other SO posts and I've seen that people had a similar problem to mine before. However, in my case when I load my RData workspace in RStudio it works just fine. However, when I try to load it in the server I get the following error:
Error in load(file = "/home/ubuntu/myfile.RData") :
bad restore file magic number (file may be corrupted) -- no data loaded
In addition: Warning message:
file ‘myfile.RData’ has magic number 'RDX3'
Use of save versions prior to 2 is deprecated
I've loaded similar RData files in the server before and it always worked fine. The same file is loaded without any problems in RStudio as I said, but somehow the server doesn't like it
Did you update R in your computer recently? If you did, from R 3.5.0, RData are saved using version 3 by default (RDX3). If you have an earlier version of R in your server, you probably need to save your data using the right version for your server (updating R in your server is another option). Please check the option version in the help of the save command to learn how to do that.
Attempting to use the mread function to open a cpp file through R. However, when I run the script I get the following:
setwd("C:/Users/Gustavo/Documents/R/page-2018-mrgsolve-master/model")
getwd()
#> [1] "C:/Users/Gustavo/Documents/R/page-2018-mrgsolve-master/model"
library(mrgsolve)
mod <- mread("simple", "model")
#> Error: project directory 'model' must exist and be readable.
Obviously I am setting the directory to "model" itself. So why isn't R able to read it? Any help would be appreciated as I am still learning R and want to learn the mrgsolve package as well.
Additional info: R version 3.4.4. Rtools version 3.4.0. Rstudio version 1.1.463.
An adaptation to the email I sent my colleagues that were assisting me with a similar issue:
To review, I was unable to open any files through RStudio because RStudio returned error messages indicating either that the file itself or the work directory did not exist. I've done multiple installations of different versions of R, RStudio, and Rtools in an attempt to resolve the issue. I also moved the locations of files and programs of interest and changed the work directory to see if that made a difference. Unfortunately, when RStudio is first initiated on a computer, it establishes a "hidden directory" folder that retains the settings of the program when it was first initiated. However, by deleting this folder, RStudio was wiped and I was able to regain control of where files would be stored and read as desired (more on this in the following link: https://support.rstudio.com/hc/en-us/articles/200534577-Resetting-RStudio-Desktop-s-State). A combination of this and forcing Rtools to the front of the 'path' also allowed me to resolve 'status 127' errors that I was receiving as well.
Unfortunately, this is the result of a more personal issue between the initial settings that RStudio took to my computer and my attempt to manipulate where RStudio should read files which I guess were discordant of one another? Regardless, it seems that I would need to be more cognizant of how RStudio establishes a folder which retains its initial settings.
I am having an issue starting RStudio (desktop) that I did not have before.
When I fire-up RStudio, within seconds, the grey screen freezes with the following error message:
RStudio Initialization Error
Unable to establish connection with R session
Once I click 'OK', I get the following two error messages:
RStudio
Unexpected exception: The complexity of the regular expression exceeded predefined bounds...
and...
R encountered a fatal error. The session was terminated.
Any help in resolving these errors is much appreciated.
The "unexpected exception" error reads as though something's going wrong with RStudio trying to run something it's loading automatically as it is starting up. So, the related question is: how can I start RStudio fresh without opening any of the previous files/code/data?
I have tried uninstalling and reinstalling both R and RStudio, and R is installed fine (I can open and work on the R console).
I am working with:
Mac OSX 10.10.5
R 3.3.3
RStudio 1.1.423
Thank you!
Just received word from the RStudio team and their solution worked for me.
Indeed, RStudio is crashing while attempting to open a file you had
opened from a previous session. You should be able to work around this
by resetting your RStudio state.
The instructions to reset RStudio are here. Relevant excerpts:
RStudio Desktop stores your custom settings and options in a hidden
directory called RStudio-Desktop. If this directory does not exist,
RStudio will create it on start up. This directory includes user
settings, log files, and other state information. Removing (or
renaming) this directory will reset RStudio's state analogous to a
fresh installation.
We recommend renaming this directory to create a backup version
instead of completely deleting it. This allows you to save your
settings, in case you want to revert back to them. Additionally, if
you experienced a crash or RStudio failed to start, this directory may
contain vital information for determining the source of the error. In
this case, we recommend renaming this directory to
backup-rstudio-desktop and sending it along if asked by RStudio
Support.
So, simply removing the ~/.rstudio-desktop file (actually, renaming it to ~/backup-rstudio-desktop so that I have a backup) just solved the start-up issue!
As a FYI to anybody who tried the solution above without success, I ended up updating/reinstalling the xfun package (install.packages("xfun")), which resolved this issue for me when resetting my RStudio state did not.
I've been looking through other SO posts and I've seen that people had a similar problem to mine before. However, in my case when I load my RData workspace in RStudio it works just fine. However, when I try to load it in the server I get the following error:
Error in load(file = "/home/ubuntu/myfile.RData") :
bad restore file magic number (file may be corrupted) -- no data loaded
In addition: Warning message:
file ‘myfile.RData’ has magic number 'RDX3'
Use of save versions prior to 2 is deprecated
I've loaded similar RData files in the server before and it always worked fine. The same file is loaded without any problems in RStudio as I said, but somehow the server doesn't like it
Did you update R in your computer recently? If you did, from R 3.5.0, RData are saved using version 3 by default (RDX3). If you have an earlier version of R in your server, you probably need to save your data using the right version for your server (updating R in your server is another option). Please check the option version in the help of the save command to learn how to do that.
I am trying to install custom packages in my Rprofile.site file. I want to install packages in the site file because I have to install these packages on several users' computers. However, I am getting the following the error whenever I launch R.
Error in readRDS(file) : unknown input format
I have the following code added to the end of my Rprofile.site file.
if(length(grep("customPackage", installed.packages()))==0) {
install.packages("customPackage", repos=NULL, type="source")
}
The error keeps repeating itself as well until I stop the R session. If I remove that code from the site file and just install the package directly in an R session though it works fine.
The only reason I want to do it in the site file is because I will keep adding more custom packages that need to be installed on each user's machine and I would rather just call it from the site file than have each user install each custom package once.
I tried searching for the error and got a variety of answers which spoke about deleting the .Rhistory file (which I tried, but didn't work), or installing the latest version of R (I am on R-2.15.0 which is the latest version so that won't help either). I was wondering if there was any other solution to fixing this problem.
I had the same error. Simply closing RStudio, then reopening it and trying again is what worked for me. Note that restarting the R session via the RStudio menu or via rs.restartR() didn't work - only closing and reopening RStudio worked. Not sure why.