R studio cannot plot

Whenever I run plot(...), R responds as:
Error in gzfile(file, "wb") : cannot open the connection
In addition: Warning message:
In gzfile(file, "wb") :
cannot open compressed file 'C:/Users/??a??/AppData/Local/Temp/RtmpUlr2r0/rs-graphics-33489ef5-2350-404d-b2ce-2c0e0670cc02/ee54ebe5-5bda-4db2-9707-f36324c7df68.snapshot', probable reason 'Invalid argument'
Graphics error: Plot rendering error

looked into the directory, and there were no files existing. How can I fix this problem??

Does this work for you in R, but not in RStudio? (see FAQ below for disambiguation)

works fine in R, I only encounter problems when using rstudio

Some of the suggestions in this thread might be helpful (e.g. checking permissions, anti-virus software, etc):

Thanks for the bug report -- indeed, RStudio has trouble with its graphics device for Windows users who have non-ASCII characters in their username. This occurs because the temporary directory (where RStudio attempts to write its plots) typically resides as a subdirectory of the user's home folder, and because that full path contains non-ASCII characters, we run into this issue.

AFAIK the best workaround is to modify the temporary directory to point to a directory outside your home directory, e.g. you could set an environment variable:

TMPDIR = C:/tmp

See the documentation here for more information: https://support.microsoft.com/en-us/help/310519/how-to-manage-environment-variables-in-windows-xp