我正在使用Windows。當試圖在png設備上繪製圖形時,它會因錯誤而失敗。錯誤:無法啓動png()設備
我的代碼:
png("C:\\plot1.png", width = 480, height = 480, units = "px", bg = "white")
par(mar= c(4, 4, 2, 1))
hist(pwrcon$Global_active_power,col = "red", main = "Global Active Power", xlab = "Global Active Power (kilowatts)")
dev.off()
錯誤:
Error in png("C:\\plot1.png", width = 480, height = 480, units = "px", :
unable to start png() device
In addition: Warning messages:
1: In png("C:\\plot1.png", width = 480, height = 480, units = "px", :
unable to open file 'C:\plot1.png' for writing
2: In png("C:\\plot1.png", width = 480, height = 480, units = "px", :
opening device failed
誰能幫助我得到這個解決?
預先感謝
@ R.Schifini,你做編輯時添加額外的反斜線?如果是這樣(如果你的診斷結果是正確的),你已經使這個問題非常混亂... –
@BenBolker,我只格式化了代碼。我同意這很混亂,但我記得只看到一個反斜槓。這似乎是通過重新安裝解決了問題。我會投票選出整個問題,因爲它似乎沒有進一步的用處。 (編輯:我甚至複製了原始路徑和文件名) –
OK,投票結束。 –