5

I just installed Rstudio 1.0.44 on a company windows 64-bit PC. When I tried to make any plot, I got this error:

Error in (function (filename = "Rplot%03d.png", width = 480, height = 480,  : invalid 'filename'

Now the Traceback showed me this information:

8. stop("invalid 'filename'")
7. (function (filename = "Rplot%03d.png", width = 480, height = 480, units = "px", pointsize = 12, 
 bg = "white", res = NA, family = "sans", restoreConsole = TRUE,
 type = c("windows", "cairo", "cairo-png"), antialias = c("default", "none", "cleartype", "gray", "subpixel")) ...
6. do.call(what = png, args = args)
5. .rs.createNotebookGraphicsDevice(filename, height, width, units, pixelRatio, extraArgs)
4. (function () { .rs.createNotebookGraphicsDevice(filename, height, width, units, pixelRatio, extraArgs) ...
3. grid.newpage()
2. print.ggplot(x)
1. function (x, ...) UseMethod("print")(x)

I am using Rstudio 1.0.44 and I was using R Notebook. The plots can be displayed if I execute the codes in console.

My R version is:

platform       x86_64-w64-mingw32          
arch           x86_64                      
os             mingw32                     
system         x86_64, mingw32             
status                                     
major          3                           
minor          3.2                         
year           2016                        
month          10                          
day            31                          
svn rev        71607                       
language       R                           
version.string R version 3.3.2 (2016-10-31)
nickname       Sincere Pumpkin Patch       

There is another similar question on Stack overflow but there is not a workable answer. Any help will be highly appreciated!

Edit:

I used a % in the name. The issue disappeared after removing the symbol.

Phil
  • 7,287
  • 3
  • 36
  • 66
  • The simplest code will cause this problem with ggplot or just plot. I suspect this is a platform problem since I have used Rstudio and rmarkdown a lot on my personal mac and I have never encountered this problem before – convertibile IkE Jun 23 '17 at 20:59
  • It'd be nice to see the actual code chunk that led to this error. Do you use any chunk options in the chunk header? Did you set any chunk options overall in a setup chunk? Have you tried updating to the newest version of RStudio? – aosmith Jun 23 '17 at 21:08
  • 2
    I realized this is due to the filename of my Rmd file--I used a **%** in the name. The issue disappeared after removing the symbol – convertibile IkE Jun 26 '17 at 14:02

1 Answers1

4

I had this problem when using a % in the chunk name. For example

``` {r next%, echo=TRUE}

```

Worked fine once I removed the %.

PupHendo
  • 145
  • 1
  • 8
  • Same happened to me when saving an SVG plot from the library SynergyFinder run in jupyter-lab. The filename for the SVG had a % in the name and threw the same error. Removing the % fixed the issue. – Thomas Matthew Dec 16 '22 at 05:14