I am using R studio and R markdown (with knitr
) to create pdf or html report of my results. I have then used function kable
to make the table look nice on a PDF output or function htmlTable
of library expss
for html output. I have created a big table for example like:
cbind(row.number=1:10,iris[1:10,],iris[1:10,],iris[1:10,]) -> tbl1
The problem is that this table has too many columns they go outside the width of the paper. Is there a way to wrap the table with one column repeated as first column. Using the table in the example above, the output should be something like:
row.number Sepal.Length Sepal.Width Petal.Length
1 1 5.1 3.5 1.4
2 2 4.9 3.0 1.4
3 3 4.7 3.2 1.3
row.number Petal.Width Species Sepal.Length
1 1 0.2 setosa 5.1
2 2 0.2 setosa 4.9
3 3 0.2 setosa 4.7
row.number Sepal.Width Petal.Length Petal.Width
1 1 3.5 1.4 0.2
2 2 3.0 1.4 0.2
3 3 3.2 1.3 0.2
To be continued like this. I created this just by hand, I have not solved the problem already :)
I saw here that it is possible to decrease the size to the table, but that is not rely what I was looking for. Automatically adjust LaTeX table width to fit pdf using knitr and Rstudio