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

前端 未结 19 996
自闭症患者
自闭症患者 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:12

    I faced this issue lately. Try turning off your anti-virus and build the package, it might help. It worked for me. Usually anti-virus blocks the permissions and you could avoid it by disabling for sometime just before building a package.

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

    I had this error because of an invalid character in the filename to be used to save the file, in my case "/" (there are many such characters that cannot be used in a filename). I removed the character and it was solved.

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

    The reason for the error is that your username is Chinese.Please create new user folder with English in the user directory.For example, you could name the folder for "DavidSmith".Then, you need create three folders("AppData","Local","Temp").File directory C:\Users\DavidSmith\AppData\Local\Temp. In the Advanced system settings which will modify the environment variables TMP and TEMP C:\Users\DavidSmith\AppData\Local\Temp.Save them. After modification, open RStudio and try again.

    Notice:TMP and TEMP are modified in the USER VARIABLE.

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

    Just want to add more clarity(scenarios in my experience) to what M Beausoleil mentioned.

    When you are using a shared-working-directory and trying to rewrite the RDS files which are already existing in a working-directory written by some other user, you get this error.

    As some people have already quoted that deleting the existing RDS files or changing the working directory works. It's not a magic. It just works because you are writing a new RDS file and not trying to re-write the old ones.

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

    I have another instance of this error which seems to be new (or at least not listed here or here: apparently it's not OK to save a file with the name aux.RData. I guess it's a reserved filename.

    x <- rnorm(9000)
    save(x, file = "aux.RData")
    
    Error in gzfile(file, "wb") : no se puede abrir la conexión
    Also: Warning message:
    In gzfile(file, "wb") :
      cannot open compressed file 'aux.RData', probable reason 'No such file or directory'
    

    But when I change the filename saves with no problem:

    save(x, file = "aux_file.RData")
    
    0 讨论(0)
  • 2021-02-05 07:16

    In my case, I received the error "Error in gzfile(file, "wb") : cannot open the connection" when trying to exit R in the Anaconda Prompt and saving workspace image. I am using Windows 10 and R-3.5.2. To fix it, I had to go to the Program Files folder, right click and the R folder, then selected Properties. Selected the Security tab, then, in the Group or user names box, selected Users, then clicked Edit. In the Permissions for Users, I checked Full control and Modify and saved the changes. Then I was able to save the workspace image.

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