R won't load throwing the following error:
Error: bad restore file magic number (file may be corrupted) -- no data loaded
In addition: Warning message: file ‘.RData’ has magic number ''
Use of save versions prior to 2 is deprecated
How might I resolve this error?
It looks like your .RData file is corrupt. Try removing or renaming it, i.e.
rm .RData
or
mv .RData _RData
Related
For some reason, when I run devtools::load_all() command within the R package I am developing, I get the following error message:
Error in FUN(X[[i]], ...) : empty (zero-byte) input file
I have made sure there are empty files in the R folder. I have an inst folder with scripts but the smallest of them 887B. I have .rda files in the data folder and they are all greater than 0.5KB or greater. Any thoughts as to why this might be happening?
I have been trying to save my R environment to load in later sessions (my environment has about 12 data frames).
save.image(file = 'tests.RData')
if I look in my directory, my file looks like data has been saved since the .RData file is about 40MB in size.
Now when I try to load the file in the directory...
load('test.RData')
I get this error:
Error: bad restore file magic number (file may be corrupted) -- no data loaded
In addition: Warning message:
file 'tests.RData' has magic number ''
Use of save versions prior to 2 is deprecated
I tried looking at previous issues with this, and the only advice was to try load() and source(). However, I believe load() is for .rda/.RData files.
Is there anyway to save my environment and load it properly? What is causing my issue exactly?
So basically I succesfully exported my SQL view data into a csv file. but no when I load into Rgui software, I get the following errror:
> load("C:\\Users\\dachen\\Documents\\vTargetBuyers.csv")
Error: bad restore file magic number (file may be corrupted) -- no data loaded
In addition: Warning message:
file ‘vTargetBuyers.csv’ has magic number 'Marit'
Use of save versions prior to 2 is deprecated
What should I do? Is it the R version installed wrong? or something wrong with my CSV file?
Try using read.csv instead of load. load is for reading files created by save.
Type ?read.csv to access the documentation.
I'm running a script with input parameters that are referenced in the code to automate the directory creation, download of file and untar of file. I would be fine with unzip, however this particular file I want to analyze is .tar.gz. I manually unpacked and it was tar.gz, unpacked to .tar file. Would that be the problem?
Full error: Error in untar2(tarfile, files, list, exdir) : unsupported entry type ‘’
Running Windows 10, 64 bit, R set to: [Default] [64-bit] C:\Program Files\R\R-3.2.2
Script notes one solution found (issues, lines 28-31), but I don't really understand it.
I did install 7-zip on my computer, restart and of course restart R:
`#DOWNLOADING AND UNZIPPING TAR FILE
#load required packages.
#If there is a load package error, use install.packages("[package]")
library(dplyr)
library(lubridate)
library(XML) # HTML processing
options(stringsAsFactors = FALSE)
#Set directory locations, data file and fetch data file from internet
#enter full url including file name between ' ' marks
mainDir<-"C:/R/BEES/"
subDir<-"C:/R/BEES/Killers"
Fetch<-'http://dds.cr.usgs.gov/pub/data/nationalatlas/afrbeep020_nt00218.tar.gz'
ArchFile<-basename(Fetch)
download.file<-(ArchFile)
#Check for file directories and create if directory if it doesn't exist
if(!file.exists(mainDir)){dir.create(mainDir)}
if(!file.exists(subDir)){dir.create(subDir)}
#set the working directory
setwd(file.path(subDir))
#check if file exists and download if it doesn't exist.
if(!file.exists(ArchFile))
{download.file (url=Fetch,destfile=ArchFile,method='auto')}
#unpack and view file list
untar(path.expand(ArchFile),list=TRUE,exdir=subDir,compressed="gzip")
list.files(subDir)
#Error: Error in untar2(tarfile, files, list, exdir) :
# unsupported entry type ‘’
#Need solution to use tar/untar app
#instructions here: https://stevemosher.wordpress.com/step-10-build/`
Appreciate feedback - I've been lurking around StackOverflow for some time to use other people's solutions.
Every time I enter this line
cameradata <- read.xlsx("./data/cameras.xlsx" , 1)
I get error:
Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod",
cl, : java.util.zip.ZipException: invalid entry size (expected 500
but got 502 bytes)
I have tried to clear RAM but file size is 10kp
Try this :-
May be this can work. It worked for me
1) when downloading the xlsx file, use this
download.file(fileURL, destfile="./whatever", mode="wb")
2) Switched to regular R, not R Studio,
The xlsx file you are trying to read maybe damaged. Try redownload the file or read another "healthy" xlsx file.
I had experience exactly the same issue.
What I did to resolve the problem was:
I had defined separate variable "fileURL2" and assigned "XLSX" download link
I had defined separate variable "cameraData2" and loaded XLSX file to it
I had downloaded file directly with Firefox and open it with MS Excel to assure it is OK, then I had save it to the working directory of "R" overwriting existing "cameras.xlsx" file
After new attempt to read the file with "R" read.xlsx() - was successful
In conclusion it seems that "R" had corrupted XLSX file during the download - which might be caused by a BUG inside of current version of the language.