How to use knitr+markdown to produce complex table

329 views
Skip to first unread message

Qike Li

unread,
Feb 19, 2014, 1:43:50 PM2/19/14
to kn...@googlegroups.com
Hi, I am writing a .Rmd file in Rstudio. I am trying to generate a complex table with headers and sub-headers. Also different number of columns for each row. 

Can anyone tell me how to do this?

Thanks
Qike 

Jeff Newmiller

unread,
Feb 19, 2014, 1:56:51 PM2/19/14
to Qike Li, kn...@googlegroups.com

If the table has significant irregularities then almost any re-usable function won't be much use. There is always the option of composing it manually, using backticks to plug in numbers where you want.

The "tables" package is good for Rnw (LateX), but not so good with irregular layout. The "xtables" package is good for either html (Rmd) or LateX (Rnw), but again not for irregular layout.

--
You received this message because you are subscribed to the Google Groups "knitr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to knitr+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Jeff Newmiller

unread,
Feb 19, 2014, 7:14:45 PM2/19/14
to Qike Li, kn...@googlegroups.com

Some versions of markdown (e.g. pandoc) include a simple table translation syntax, but most require you to use html table syntax, which is rather more verbose than typical markdown [1]. You will probably need to study HTML and CSS syntax to get the results you want, and it may still not satisfy you due to the independent decisions that browsers can make in displaying the table. That is one reason I do more work in Rnw files than in Rmd files.

[1] http://daringfireball.net/projects/markdown/syntax
[2] Google to learn, for example see http://www.w3schools.com/css/css_table.asp

On Feb 19, 2014 11:39 AM, "Qike Li" <liq...@gmail.com> wrote:
Hi Jeff,

Thank you for your response! Would you direct me to the references of how to make the irregular tables manually in markdown?

Thanks,
Qike

rahul kumar

unread,
Nov 15, 2014, 3:33:41 AM11/15/14
to kn...@googlegroups.com
Try CSS styling in HTML table....
 
 
Ling
Reply all
Reply to author
Forward
0 new messages