4

还有其他人有这个问题吗?

> d <- data.frame(x=1:5, y=6:10)
> print(d, type="html", file="d:/delete/test5.html")
  x  y
1 1  6
2 2  7
3 3  8
4 4  9
5 5 10

我的 R 版本是 2.12.2 版本,xtable 版本是 xtable_1.5-6。

4

1 回答 1

13

您还没有创建xtable对象,只是创建了一个数据框。print为不包括写入文件选项的数据框运行适当的方法也是如此。尝试:

d <- data.frame(x=1:5, y=6:10)
x <- xtable(d)
print(x, type="html", file="d:/delete/test5.html")

更一般地说,如果您想将内容写入文件,您可以尝试cat.

于 2011-06-09T15:49:59.163 回答