Remove comments from LaTeX output in .Rmd

So, I'm using downloadHandler to create a report, and as advised in an example I found on the net, I've created a .Rmd file that servers as a template.

xtable(mydata)

prints mydata nicely, but the comments that xtable generates are being printed on the final output, complete with their initial % signs.

Is there a way to tell that TeX comments should be treated as comments?

1 Like

This stackexchange question seems to address this issue. If none of the options there could you create a reprex and I'd love to help out!

1 Like

We don't really have enough info to help you out. Could you ask this with a minimal REPRoducible EXample (reprex)? A reprex makes it much easier for others to understand your issue and figure out how to help.

If you've never heard of a reprex before, you might want to start by reading this FAQ:

As noted in the linked answer in @dlsweet's reply, print(xtable(mydata), comment=FALSE) will get rid of the latex timestamp comment. Also, to prevent xtable from the adding the timestamp comment ever, after you load the xtable package, run options(xtable.comment=FALSE). Then you can just do xtable(mydata) from then on.

For creating tables more generally, there are a few other options that take much of the pain out of custom-formatting latex table output. For example:

2 Likes

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.