I have following folder structure.
C:\Folders\Subfolder\Sub-Subfolder\Sub-Sub-Subfloder
and also have file called grphics01.pdf
and I want to save grphics01.pdf
file to this C:\Folders\Subfolder\Sub-Subfolder\Sub-Sub-Subfloder
folder.
My current working directory is different than this folder structure.
When I am using following code:
directory <- "C:\\Folders\\Subfolder\\Sub-Subfolder\\Sub-Sub-Subfloder\\"
ggsave(filename = here(directory, "graphics01.pdf"), width = 30, height = 20, units = "cm",
device = cairo_pdf())
I am getting this error:
Error in grDevices::pdf(file = filename, ..., version = version) :
cannot open file 'C:\Folders\Subfolder\Sub-Subfolder\Sub-Sub-Subfloder\/graphics.pdf'
As per my understanding, Sub-Sub-Subfloder\/graphics.pdf
the front-slash in-front of the file name is causing the error.
Is there any way can I convert this front-slash to a back-slash?
I have to resolve the issue by using "here" package and defining
ggsave(path = directory, filename = "graphics01.pdf, device = pdf)
But I am getting the same eror.