cover image
Exporting Tables from R using Flextable, Kable and gt

Available Languages:

< Browse all resources and collections

Description

Dated: June 2020

Author: Alex Thomson

This trove is based on an internal seminar given at Stats4SD. The presentation and accompanying code examples present a set of options for generating and exporting lovely tables from R into pdf, html, Word etc. This is for anyone who wishes to begin learning a little bit more about how they can create nicer looking tables within R without copying and pasting information or images. The presentation included explains each of the 3 packages in more detail and considers their relative strengths and weaknesses. This file should be considered as a starting point.The examples focus on 3 packages:FlextableKablegtHow to run Examples;Open any of the Rmd files in RStudio.Run the first chunk to load required libraries.If you get errors, check you have the required libraries installed.Change the working directory to your new local folder (remember that you will need to extract the data from the zip file that is included in this resource, you may need to change some file paths in the RMD files to get them working)Run any of the other chunks to see the sorts of output you can get.If you want to see how all of your tables will appear in html, press the "knit" button in the bar at the top of the markdown file and then press "knit to html"If you want to try knitting the flextable examples into word then you can do one of two thingsRemove the special example which includes images and then this will run just fine; or;Ensure the package "officedown" is installed and loaded. Then add the code&nbsp;output::officedown:rdocx_document&nbsp;to the YAML header at the top of the RMD script. Then you will be able to knit to a rdoxc word document (officedown is used to format word documents from rmakdown, this is just the name of the output type it creates but it will just open a normal document in microsoft word)

View/download

The individual components of the trove are listed below. Click on one to download the file or go to the external url. You can download the full trove below as a .zip file.

https://github.com/stats4sd/JuneSeminarTablesfromR

https://github.com/stats4sd/JuneSeminarTablesfromR

VISIT LINK

Flextable.html

15 MB

DOWNLOAD

Flextable.Rmd

16 KB

DOWNLOAD

gt-examples-june-seminar.Rmd

10 KB

DOWNLOAD

gt-examples-june-seminar.html

717 KB

DOWNLOAD

Data.zip

11 MB

DOWNLOAD

KableExtra.html

741 KB

DOWNLOAD

Exporting-Tables-from-R---Seminar-June.pptx

9 MB

DOWNLOAD

KableExtra.Rmd

13 KB

DOWNLOAD
DOWNLOAD ALL (ZIP)

Collections including this resource

No collections available for this resource.

Related resources

No related resources found.