r - Error in gzfile(file, wb): cannot open the connection or compressed file

r – Error in gzfile(file, wb): cannot open the connection or compressed file

r – Error in gzfile(file, wb): cannot open the connection or compressed file

This is a bit late but for anyone coming here for help, I got this error when I was trying to write a file from RStudio and my destination file path was very long. I realized this could be a problem because when I wrote the file to another location with a shorter name and tried to copy it into my original destination, Windows gave me an error saying File path too long. You might need to save the original file into another location with a shorter absolute path.

Maybe you should look here. At the end it says

n

n

Note:n The most common reason for failure is lack of write permission in the current directory. For save.image and for saving at the end of a session this will shown by messages like

n

n

Error in gzfile(file, wb) : unable to open connectionnIn addition: Warning message:nIn gzfile(file, wb) :n  cannot open compressed file .RDataTmp,n  probable reason Permission deniedn

n

So rapidly, if you try getwd(), look at where is your working directory set. If youre trying to save your document in a place where its not in your current working directory, it will throw you this error.

n

At the end of your error message, it says probable reason No such file or directorynGraphics error: Error in gzfile(file, wb) : cannot open the connectionnnMy diagnosis would be simply that its trying to save your item in the wrong place and RStudio is not able to find the right place.

r – Error in gzfile(file, wb): cannot open the connection or compressed file

This burned me so hopefully saves someone else some toil. The issue was that the classifiers loaded just fine on OS X but on the Linux deployment system they would fail with the error listed in the question. The issue was the the files on the disk had extension abc.RData but the code modelAbc <- readRDS(file=abc.Rdata). The difference in the upper and lowercase D in the .RData vs .Rdata extension would fail on Linux. It was not very noticeable but check your extensions for case.

Related posts on R Error :

Leave a Reply

Your email address will not be published. Required fields are marked *