Tested on Windows 11 and Amazon Linux 2023
When saving a plot to a directory containing a % character via ggsave one has to use %% in order for the character to be read as a single %.
However, when you do this ggsave will prompt that it cannot find the directory and ask to create a directory (or automatically create the directory if create.dir = TRUE).
It will then proceed to create a directory where all %% are interpreted literally as two % characters, but continue to store the file in the original requested directory, leaving the newly created directory empty.
Obviously, this second directory should never be created.
Reprex:
dir.create("a%b")
ggplot2::ggsave("a%%b/test.png",
ggplot2::ggplot(cars) + ggplot2::geom_bar(ggplot2::aes(x = speed)),
create.dir = TRUE)
#> ✔ Created directory: 'a%%b'.
#> Saving 7 x 5 in image
Tested on Windows 11 and Amazon Linux 2023
When saving a plot to a directory containing a
%character viaggsaveone has to use%%in order for the character to be read as a single%.However, when you do this
ggsavewill prompt that it cannot find the directory and ask to create a directory (or automatically create the directory ifcreate.dir = TRUE).It will then proceed to create a directory where all
%%are interpreted literally as two%characters, but continue to store the file in the original requested directory, leaving the newly created directory empty.Obviously, this second directory should never be created.
Reprex: