Reputation: 149
Sorry if this is a very trivial question but I've looked up and down the internet and can't find an answer. I'm making a basic table using the gt package in markdown. But I can't seem to get the text to wrap when knitting to a *.pdf. Any help would be greatly appreciated!
table_data %>% gt()
Upvotes: 8
Views: 700
Reputation: 142
Not an answer, but a reproducible working example.
---
title: "Test"
output: pdf_document
---
```{r test, echo=FALSE, warning = FALSE}
library(tidyverse)
library(gt)
test <- data.frame(v1=c(
"This is a long string. This is a long string. This is a long string. This is a long string. This is a long string.",
"This is a another long string. This is a another long string. This is a another long string. This is a another long string. This is a another long string."),
v2=c(1, 2))
test %>% gt()
```
results in:
I ended up going with kableExtra
instead. With the reproducible working example, replace test %>% gt()
with test %>% kable() %>% kable_styling(full_width = TRUE)
Upvotes: 6