创建一些图表,并希望创建日期/时间在文件名中。我发现this question的答案在这个主题上非常有帮助,而且
paste("plotname",Sys.time(),".wmf",sep='')是否真的会吐出
[1] "plotname2013-07-02 11:55:04.wmf"但
win.metafile(paste("plotname",Sys.time(),".wmf",sep=''))
# win.metafile("test.wmf")
ggplot(data.file, aes(x = group, y = delta)) + geom_boxplot()
dev.off()给出
Error in win.metafile(paste("plotname", Sys.time(), ".wmf", sep = "")) : unable to start win.metafile:plotname2013-07-02 11:56:23.wmf() device在这里,它使用更简单的win.metafile("test.wmf")命令。这里有什么问题?
发布于 2013-07-03 00:20:46
win.metafile(paste("plotname",format(Sys.time(),"%y%m%d.%M%H"),".wmf",sep=''))这对我很有效。我认为问题出在文件的格式上--根据Hong Ooi的回答,Windos不允许在文件名中使用冒号。时间表示为年/月/日.小时/分钟
有关格式化的更多信息,请查看http://stat.ethz.ch/R-manual/R-patched/library/base/html/strptime.html。你也可以添加不同的东西,比如:
format(Sys.time(),"%y see? %m")发布于 2013-07-03 00:29:38
https://stackoverflow.com/questions/17430466
复制相似问题