4

Is anyone else having this problem?

> 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

My R version is version 2.12.2 and xtable version is xtable_1.5-6.

Tom
  • 4,860
  • 7
  • 43
  • 55

1 Answers1

13

You haven't created an xtable object, only a data frame. So print is running the appropriate method for a data frame which doesn't include the writing to file options. Try:

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

More generally, if you want to write things to a file, you can try cat.

Tom
  • 4,860
  • 7
  • 43
  • 55
joran
  • 169,992
  • 32
  • 429
  • 468