Error in gzfile(file, “wb”): cannot open the connection or compressed file

前端 未结 19 1067
自闭症患者
自闭症患者 2021-02-05 06:49

I\'m trying to run two things: first, I\'m creating a PDF with 4x5, ending with dev.off(), and then trying to create a new graph. However, after starting the second plot, I get:

相关标签:
19条回答
  • 2021-02-05 07:07

    I had the same problem.For me, it was caused due to not having enough disk space on the drive where R studio was installed.Freeing up space works.

    0 讨论(0)
  • 2021-02-05 07:08

    In my case, this error was because the file that I wanted to re-write, was read-only (for whatever reason, I didn't do it myself). I just right-click on the file's name in the folder and unchecked the read-only property. After that it worked.

    0 讨论(0)
  • 2021-02-05 07:09

    Problem resolved by specifying full file path:

    saveRDS(df,'C:\\users\\matt\\desktop\\code\\df.Rdata')
    
    0 讨论(0)
  • 2021-02-05 07:09

    I also had this problem when working with RStudio and R Markdown. I was getting this error message and had an annoying number of fatal errors which closed RStudio. My issue was that I was working off a network drive and either the name was too long, as in @AHedge above or my network firewalls were giving me trouble. For the moment, I have moved my working files to my desktop and things seem to be working fine. Not sure what this means for my file management over time.

    0 讨论(0)
  • 2021-02-05 07:11

    Haven't seen this case in the other answers: if this seems to happen all the time, and to be very persistent when it does happen, check the default directory in your file handling software connection.
    In my case FileZilla was logging on to my DigitalOcean droplet as "root" and whenever I used FileZilla to create a directory it was setting write permissions to "root", whereas my RStudio on the same droplet read/wrote as "My_Name". Anytime I set something up in FZ (e.g. large imported files, renamed or copied) the permissions would switch and I'd get this error.
    If this is what is causing frequent error messages it can be solved instantly with chown -R My_Name directoryname but in the longer run, if you are going to be using your file handler to define and create a lot of directories, it will pay to create a connection whose default name is the same name you use for RStudio.

    0 讨论(0)
  • 2021-02-05 07:12

    You may have no permission to save file in the directory. On RStudio, get your working directory by getwd(). Then, go to the directory in linux and observe its owner by ls -l. Now you can change the owner of the directory by chown -R username directoryname. But you must be root.

    0 讨论(0)
提交回复
热议问题