gt
gt copied to clipboard
Font size extremely small when exporting table to Word
Thank you for creating this amazing package, keep up the good work. I have the following code:
library(gt)
library(dplyr)
library(tibble)
eig_val_adpt <- tibble(
Dimension = c("PC1", "PC2", "PC3", "PC4"),
eigenvalue = c(1.9750938, 1.1410984, 0.7621376, 0.1216701),
variance_percent = c(49.377345, 28.527461, 19.053441, 3.041753),
cumulative_variance_percent = c(49.37735, 77.90481, 96.95825, 100.00000)
)
gt_table <- gt(eig_val_adpt) %>%
tab_header(
title = "PCA eigenvalues and variance explained for the adaptability variables"
) %>%
fmt_number(
columns = c(eigenvalue, variance_percent, cumulative_variance_percent),
decimals = 2
) %>%
tab_style(
style = cell_text(font = "Times New Roman", size = "12px"),
locations = cells_body()
) %>%
tab_style(
style = cell_text(font = "Times New Roman", size = "12px"),
locations = cells_column_labels()
) %>%
tab_style(
style = cell_text(font = "Times New Roman", size = "14px", weight = "bold"),
locations = cells_title()
)
gtsave(gt_table, "path/test.docx")
I even tried to increase the font size. Why is that?
R 4.4.0, RStudio 2024.04.2 Build 764, Windows 11.