Huxtable is a package for creating text tables. It is powerful, but easy to use. Huxtable’s features include

yearcontinentcountrylifeExppopgdpPercap
2002AsiaAfghanistan42.125268405727       
EuropeAlbania75.735085124.6e+03 
AfricaAlgeria71  312871425.29e+03
Angola41  108661062.77e+03
AmericasArgentina74.3383311218.8e+03 
OceaniaAustralia80.4195467923.07e+04

Getting started with huxtable

Pots of jam for sale
TypePrice
Strawberry1.90
Raspberry2.10
Plum1.80

Advanced formatting and markdown

Type of jam

Price of jam

Strawberry1.9     
Raspberry

2.1 Sale! 1.5

Plum1.8     

Border formatting

TypePrice
Strawberry1.9
Raspberry2.1
Plum1.8

Formatting a larger table

SepalPetal
SpeciesLengthWidthLengthWidth
setosa5.13.51.40.2
setosa4.93  1.40.2
setosa4.73.21.30.2
setosa4.63.11.50.2
setosa5  3.61.40.2
versicolor7  3.24.71.4
versicolor6.43.24.51.5
versicolor6.93.14.91.5
versicolor5.52.34  1.3
versicolor6.52.84.61.5
virginica6.33.36  2.5
virginica5.82.75.11.9
virginica7.13  5.92.1
virginica6.32.95.61.8
virginica6.53  5.82.2

reshaping

Restacked down
15
26
913
1014
37
48
1115
1216

Table position and column width

SepalPetalSepalPetalSepalPetal
SpeciesLengthWidthLengthWidthSpeciesLengthWidthLengthWidthSpeciesLengthWidthLengthWidth
setosa5.13.51.40.2versicolor7  3.24.71.4virginica6.33.36  2.5
setosa4.93  1.40.2versicolor6.43.24.51.5virginica5.82.75.11.9
setosa4.73.21.30.2versicolor6.93.14.91.5virginica7.13  5.92.1
setosa4.63.11.50.2versicolor5.52.34  1.3virginica6.32.95.61.8
setosa5  3.61.40.2versicolor6.52.84.61.5virginica6.53  5.82.2

Themes

Most populous Countries, 2002
countrycontinentlifeExppopgdpPercap
ChinaAsia72  12804000003.12e+03
IndiaAsia62.910341725471.75e+03
United StatesAmericas77.32876755263.91e+04
IndonesiaAsia68.62110600002.87e+03
BrazilAmericas71  1799142128.13e+03
PakistanAsia63.61534035242.09e+03
BangladeshAsia62  1356567901.14e+03
JapanAsia82  1270658412.86e+04
NigeriaAfrica46.61199012741.62e+03
MexicoAmericas74.91024799271.07e+04
jams %>% 
      set_all_padding(4) %>% 
      set_outer_padding(0) %>% 
      set_number_format(2) %>% 
      set_bold(1, everywhere) %>% 
      set_bottom_border(1, everywhere) %>% 
      set_width(0.4) %>% 
      set_caption("Pots of jam for sale")
Pots of jam for sale
TypePrice
Strawberry1.90
Raspberry2.10
Plum1.80

Using assignment

embed_flipbook("hux_set", font_size = 120, 
               use_embed_xaringan = T, 
               left_assign = T,
               widths = c(4.5,3),
               use_share_again = T)