Creating a png file with the png device fails because of long filenames but the names are shorter than the supported size according to documentation.
I am creating graphs from various subsets of hierarchical data in a dataframe with the treemap library. For a better overview i create file directories mirroring that hierarchical structure and save each graph in the corresponding directory.
I have written a function that removes illegal characters and specific german characters that seem to trouble the png device. However the most recent error message seems to be related to the length of the filename in the png command. According to the documentation the maximum length of the filename is 511 characters which i am not close to. I have three questions
- Is the length of the filename really the issue?
- If so, why when the length is considerably lower than it has to be according to documentation?
- What would be a elegant, suitable workaround?
Breite<-1366
Hohe<-768
###This works:
png(file="b4-Kapitel 4- Funktionen des kardiovaskulaeren,
haematologischen, Immun- und Atmungssystems_1366x768.png",
width=Breite,
height=Hohe)
png(file="ICFGrafiken/Klassifikation der Koerperfunktionen/Kapitel 4-
Funktionen des kardiovaskulaeren, haematologischen, Immun- und
Atmungssystems/b4-Kapitel 4_1366x768.png",
width=Breite,
height=Hohe)
###This doesn't work:
png(file="ICFGrafiken/Klassifikation der Koerperfunktionen/Kapitel 4-
Funktionen des kardiovaskulaeren, haematologischen, Immun- und
Atmungssystems/b4-Kapitel 4- Funktionen des kardiovaskulaeren,
haematologischen, Immun- und Atmungssystems_1366x768.png",
width=Breite,
height=Hohe)
The error message is:
Error in png(file = "ICFGrafiken/Klassifikation der Koerperfunktionen/Kapitel 4- Funktionen des kardiovaskulaeren, haematologischen, Immun- und Atmungssystems/b4-Kapitel 4- Funktionen des kardiovaskulaeren, haematologischen, Immun- und Atmungssystems_1366x768.png", :
kann png()-Gerät nicht starten
In addition: Warning messages:
1: In png(file = "ICFGrafiken/Klassifikation der Koerperfunktionen/Kapitel 4- Funktionen des kardiovaskulaeren, haematologischen, Immun- und Atmungssystems/b4-Kapitel 4- Funktionen des kardiovaskulaeren, haematologischen, Immun- und Atmungssystems_1366x768.png", :
kann Datei 'ICFGrafiken/Klassifikation der Koerperfunktionen/Kapitel 4- Funktionen des kardiovaskulaeren, haematologischen, Immun- und Atmungssystems/b4-Kapitel 4- Funktionen des kardiovaskulaeren, haematologischen, Immun- und Atmungssystems_1366x768.png' nicht zum Schreiben öffnen
2: In png(file = "ICFGrafiken/Klassifikation der Koerperfunktionen/Kapitel 4- Funktionen des kardiovaskulaeren, haematologischen, Immun- und Atmungssystems/b4-Kapitel 4- Funktionen des kardiovaskulaeren, haematologischen, Immun- und Atmungssystems_1366x768.png", :
opening device failed