繁体   English   中英

这是什么错误; “(函数(文件名 =“Rplot%03d.png”,宽度 = 480,高度 = 480,:无法启动 png() 设备)中的错误?

[英]What is this error; "Error in (function (filename = "Rplot%03d.png", width = 480, height = 480, : unable to start png() device"?

每当我使用 ggplot2 时,我都会遇到同样的错误

x2012 <- data.frame(readRDS(file = "Exercises05/x2012_1_6cleaned10.Rda"))

i <- 1

while (i<=250){
  x2012[[i,1]] <- mean(sample(nrow(x2012), 25, replace = FALSE))
  i = i+1
}

mean(x2012$sumtotprice)
sd(x2012$sumtotprice)

library("tidyverse")

ggplot(x2012, aes(sumtotprice)) +
  geom_density()

(function (filename = "Rplot%03d.png", width = 480, height = 480, : 无法启动 png()

数据集无关紧要,我总是收到此错误。

感谢您的时间,并为没有提供更一般的例子道歉!

谢谢回复,

在 r2evans 发布的线程 (stackoverflow.com/q/45113597) 中,我找到了以下解决方案:

将降价保存为新文件将暂时解决问题,但是,我不知道长期解决方案。

我相信这与 Windows 中的路径长度限制有关。 在 RMD 中呈现“内联”输出时,它似乎是通过 tmp 目录发生的,该目录引发错误,因为其父路径太长。 但是,如果您只是更改选项以使输出在控制台中而不是通过添加内联

editor_options: 
  chunk_output_type: console

在文档的顶部,它似乎为我修复了它。 这也可以在从 RStudio 源窗格顶部的齿轮图标下拉菜单中完成。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM