Error in load("/media/physioch/data/Combined/allcx/subsets/ecallcx subsets.RData") :
bad restore file magic number (file may be corrupted) -- no data loaded
In addition: Warning message:
file ‘ecallcx subsets.RData’ has magic number 'Featu'
Use of save versions prior to 2 is deprecated
I looked into some forums and understood that this could be a problem of R version.
While saving the file, I did not do anything different: I simply used save button in the Environment space and replaced the already existing file.
I tried using ReadRDS, readr but no help.
How can I restore my file?
other details:
platform x86_64-pc-linux-gnu
arch x86_64
os linux-gnu
system x86_64, linux-gnu
status
major 3
minor 6.1
year 2019
month 07
day 05
svn rev 76782
language R
version.string R version 3.6.1 (2019-07-05)
nickname Action of the Toes
Likely it's a file that got misnamed with the wrong extension. The magic number should start with "RDA2" or something like that. File format magic numbers are traditionally the first bytes of a file. Seeing something that looks like a fragment of a column name leads one to believe that it's not an RData file, some plain text that begins with "Featu"
Could be a CSV or TSV file
Is the first column of the data named "Feature"? It might be an issue of a someone using write() instead of save() to serialize a data frame to disk. If that is the case, read.csv() or read.delim() would be appropriate.
Could be RDS file
Try readRDS() if the above doesn't work. It doesn't seem like it should be an ascii rds file, but worth a try if it's not csv or tsv.
This gives list of all commands that I previously ran on data.
I don't quite understand what caused this.. (you wrote " It might be an issue of a someone using write() instead of save() to serialize a data frame to disk" I have to read to understand this) but I saved the files like this (save button in 'environment' space) before without any problem.
My file contained a lot of data (objects, data frames etc). Please guide me- how can I restore the file.
The save workspace button of Rstudio should have created an RData file. If you're seeing that file is a csv file, then it was likely overwritten somehow. Unfortunately, that means the file that the workspace was saved to is no longer there. This could have by passing the .RData path to a subsequent call to write.csv() or perhaps when copying or moving files around from whatever file manager on the system is.
Recovery
If the file was indeed overwritten, recovering an overwritten file may be possible, but seems unlikly. It will dependent on your operating system and file system configuration, and is beyond the scope of this forum. I would not expect that the original RData file is recoverable.