Using xtable I am trying to format a table

x<- 1:5
y<- 11:15
mytable <- table(x,y)

Which gives:

enter image description here

I want to add x and y tags also at the top of the rows and sides like this:

enter image description here

1 Answer 1


I have a package called printr, which has not been published to CRAN but might be useful to you. See its vignette for more information. Note you need to install the development versions of knitr and printr from Github.

Here is a preview of results from R Markdown, and it should not make a difference if you use it .Rnw documents. The positions of x and y may not be what you want, though.

print tables with printr

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .