From the course: Creating Reports and Presentations with R Markdown and RStudio

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Formatting tables with kable()

Formatting tables with kable() - RStudio Tutorial

From the course: Creating Reports and Presentations with R Markdown and RStudio

Start my 1-month free trial

Formatting tables with kable()

- [Instructor] If you want to customize the appearance of tables in R Markdown documents, independent of PDF or HTML, then I cannot recommend the kable package enough. Let's show you how you can use it by navigating to the exercise files, folder zero eight underscore zero four, and let's open up our R Studio project. Let's open up our R Markdown file, and let's knit it together and see what we have. Okay, so at the top of our document we have some code, which generates us the table, and a second block of code which generates us a table, and then an image down at the bottom. It'd be really nice if we could use the kable package to format these for us. So, let's go and do that. I'll go back to my R Markdown file, I'll focus on that by pressing control shift one, and we'll add a pipe to the end of line 27. We'll type knitr kable. Now I'll do the exact same in the second code chunk. Pipe knitr kable. So let's save our document and knit it together. Okay, great, our tables look much better…

Contents