将直方图从R导出到Excel [英] Exporting Histogram from R to Excel
问题描述
每个直方图都有10,000个数据,所以我不能只是输出原始数据并在excel中创建直方图(我假设这将导致一个可笑的大小的excel文件,我不想要)
有没有办法导出我的图?
p> excel.link包是RDCOMClient的包装器。
以下示例仅在正常的RGui(不是RStudio)的R 3.0.1中适用于我。 / p>
#加载包
require(excel.link)
#plot something
plot(cos)
#将图保存到tmp文件
cos.plot = current.graphics()
#添加excel工作簿
xl。 workbook.add()
#添加工作表excel工作簿
xl.sheet.add()
#将您的图形从单元格A1的左上角开始
xl [a1] =列表(余弦绘图,cos.plot,余弦绘图结束)
I have some data in R that I would like to represent as a histogram (actually, I'll have 6 histograms) and then export those graphs into an excel file. I have just been using the hist() function, but I'm also experimenting with ggplot2 functions. Every histogram has 10,000 pieces of data, so I can't just export the raw data and create the histograms in excel (I'm assuming that this would lead to a ridiculously sized excel file, which I don't want).
Is there any way I can export my graphs?
The excel.link package is a wrapper to RDCOMClient.
The following example only worked for me in R 3.0.1 in the normal RGui (not RStudio).
# load package
require(excel.link)
# plot something
plot(cos)
# save graph to tmp file
cos.plot=current.graphics()
# add excel workbook
xl.workbook.add()
# add sheet to excel workbook
xl.sheet.add()
# put your graph starting at the top left in cell A1
xl[a1]=list("Cosine plotting",cos.plot,"End of cosine plotting")
这篇关于将直方图从R导出到Excel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!