I have been trying to style markdown tables (changing font size, adding scroll bars, etc) to beautifully displayed in the knitted md files that I shared via GitHub with my team. When I use kable_styling()
and check it in the preview (html) locally it works. But then the md generated file just shows default table formats. I wonder what kind of additional setup should I configure.
this is my code:
---
title: User behaviour in music promotions
output:
github_document:
fig_width: 8
fig_height: 6
dev: png
editor_options:
chunk_output_type: console
always_allow_html: true
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE, message = FALSE, warning = FALSE)
options(knitr.table.format = 'markdown')
#options("httr_oob_default" = TRUE)
#options(knitr.table.format = "latex")
# eval = FALSE argument, R will NOT evaluate code in a chunk
# include = FALSE, this whole code chunk is excluded in the output, but note that it will still be evaluated if eval = TRUE
# fig.align: The alignment of plots. It can be 'left', 'center', or 'right'.
library(bqr)
library(skimr)
library(ggplot2)
library(ggspotify)
library(dbplyr)
library(lubridate)
library(tidyverse)
library(here)
library(dplyr)
library(patchwork)
library(ggrepel)
library(directlabels)
library(ggbeeswarm)
library(ggjoy)
library(ggExtra)
library(funModeling)
library(purrr)
library(extrafont)
library(showtext)
library(knitr)
library(scales)
library(ggstatsplot)
library(EnvStats)
library(glue)
library(ggpmisc)
library(timetk)
library(plotly)
library(gganimate)
library(gifski)
library(png)
library(kableExtra)
library(gridExtra)
library(urltools)
library(parsedate)
library(ggside)
library(gt)
```
``` {r echo=FALSE}
df %>%
knitr::kable(align=rep('c', 20)) %>%
kable_styling(font_size = 12,
full_width = F,
position = "center") %>%
scroll_box(width = "100%", "300px")
```