The issue I'm having is with formatting longer strings that do not have a space or separator (index sequence column in image below). In the below image you can see that:
a) in rows with a background color the sequence is covered by the next cell
b) in rows without a background color the sequence invades the next cell
I'd like to add text wrapping to make sure all of the text fits in the cells but cannot figure out how to get it to wrap properly. When I run the code in R studio everything looks ok but when I knit it to pdf much of the data does not fit and the table looks poor.
Image from R studio:
Image from PDF:
Example Code:
---
title: "Untitled"
output: pdf_document
date: "2023-08-16"
---
{r}
library(flextable)
library(magrittr)
set_flextable_defaults(font.family = 'DejaVuSansMono')
data <- read.csv("/Users/kregan1/temp/test.csv",
check.names=FALSE)
ft <- flextable(data)
ft <- autofit(ft) %>% theme_zebra()%>%bg(bg = "#44B29C", part = "header")%>% align(align="center", part="all")%>%fit_to_width(max_width = 7.5)%>% fontsize(size=7, part="all")
ft
test.csv:
"cell","project","master sample","library","insertsize","targeted frg size","sample name","external id","strain","species","library type","index","index sequence","size selected","size selected size"
"A01_1","XVOLT","MS100301111","PL100300001-1","15,436","20,000","LIB_1000","PACB001",NA,"Homo sapiens","HiFi Multiplex","bc2027","TGACTGTAGCGAGTAT","N",0
"A01_1","XVOLT","MS100301112","PL100300002-1","15,618","20,000","LIB_1001","PACB001",NA,"Homo sapiens","HiFi Multiplex","bc2028","ACTGCAGCACGAGTAT","N",0