将 R- 数据框中的文本或输出单元格中的文本换行为 Word

发布于 2024-09-15 05:00:44 字数 162 浏览 3 评论 0原文

我正在 R 中工作,尝试将数据帧导出到 MS Word。我正在使用 R2wd,希望将数据框导出到 MSWORD,并将一长串文本包装在单元格中。这可能吗?

最低限度至少要通过 R 的命令来设置每行的高度以适合单元格的内容...

我没有看到任何演示或文档,但肯定有人有时需要这样做!

I am working in R, trying to export a dataframe to MS Word. I am using R2wd and would like a dataframe to export to MSWORD, and wrap a long string of text within a cell. Is that even possible?

Bare minimum at least pass a command from R to set the height of each row to fit the contents of the cell...

I don't see any demos or documentation but surely somebody must need to do that sometimes!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

总以为 2024-09-22 05:00:44

我不确定这是否正是您想要的,但您可以使用 xtable 将 data.frame 导出到 .Rnw 文件,使用 Sweave 处理它,然后通过 Latex2rtf 运行 .tex 文件。不幸的是,latex2rtf 不能很好地格式化表格。 。 。

I'm not sure if this is exactly what you want, but you could export the data.frame to a .Rnw file with xtable, process it with Sweave, and then run the .tex file through latex2rtf. Unfortunately, latex2rtf does not format tables nicely . . .

孤独岁月 2024-09-22 05:00:44

您可以使用 odfWeave 包来做到这一点,它类似于Sweave,除了可以制作动态 odt(开放文档格式)文档。嗯,该包不会生成 doc 或 docx 文件,但在较新版本的 MS Office(2007 及更高版本)和 OpenOffice 中可以毫无问题地打开 odt - 所以可能适合您。

该包的主要优点是您可以根据自己的喜好定义表格的样式(标题或表格的每个单元格)。有关详细信息,请参阅包存档中的示例。

You could do that with the odfWeave package, which is similar to Sweave, except for you can make dynamic odt (Open Document Format) documents. Well, the package does not generates a doc or docx file, but the odt can be opened without problem in the newer versions of MS Office (2007 and above), and in OpenOffice - so might work for you.

The main advantage of the package is that you can define the styles of the table (header or every cell of the table) to your taste. See the examples in the package's archive for further information.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文