370 questions
0
votes
1
answer
70
views
How to further fine-tune the RTF output of gtsummary when pagination is needed?
Based on the previous solution,
Does the gtsummary package have a function that allows the exported table to include footnotes on every page?
I successfully implemented pagination for the RTF output, ...
0
votes
0
answers
37
views
Is it possible to make the output of gtsummary in TXT format as complete as it is in RTF format?
In this example, I attempted to use huxtable to output gtsummary objects to TXT format. However, the following issues seem to arise:
The table is centered, and the output includes column names such as ...
-1
votes
1
answer
138
views
Convert a flextable into a dataframe
After something like:
library(tidyverse)
df <- tibble(a=c(1,2,3), b=c(4,5,6))
tbl <- df %>% flextable::flextable()
Is there a way to get back df from tbl?
1
vote
1
answer
61
views
Does the gtsummary package have a function that allows the exported table to include footnotes on every page?
As discussed in the previous question, it seems difficult for gtsummary to include the same footnote on every page when exporting RTF using flextable; the footnote can only appear at the end of the ...
2
votes
1
answer
112
views
How to make the title of a gtsummary object correctly paginated and left-aligned when exporting using officer/flextable?
I have two main questions here. The first is how to control the alignment of the title specified in modify_caption so that it is displayed left-aligned when exporting to RTF using flextable/officer. ...
0
votes
1
answer
95
views
Problem aligning a table body with title footnotes in a docx file
I am using the clinify package with flextable to generate a docx file.
My issue is lining up the table body with the title footnotes. I tried using:
set_table_properties(width = 1, layout = "...
0
votes
1
answer
71
views
Why are all flextable::border() borders visible in html but not in docx/rtf/pptx export?
When adding borders to a flextable manually via flextable::border() then these are visible in html display. However, when exporting to either one of docx, rtf or pptx then only the bottom one of the ...
1
vote
1
answer
60
views
Saving modelsummary resulting flextable as .docx lose horizontal line that separates estimates from goodness of fit measure
Consider the following example:
library(modelsummary)
library(flextable)
library(officer)
modlm <- lm(gear ~ mpg + wt, data = mtcars)
res <- modelsummary(
modlm,
stars = TRUE,
out = "...
0
votes
0
answers
45
views
How can I automatically make flextable::save_as_rtf() use the entire available page width? [duplicate]
If I run the code below, I get an rtf that does not seem to use the entire page width when opened in MS Word.
flextable::flextable(head(iris)) |>
flextable::save_as_rtf(path = "test1.rtf&...
2
votes
1
answer
96
views
Convert GTSUMMARY object to FLEXTABLE
I am trying to convert gtsummary to flextable using as_flex_table. It works by default passing on information from table body. Example code is provided below:
# Load packages for program execution
pkg....
1
vote
0
answers
62
views
RMarkdown - flextable paging in pdf
I'm having trouble paginating a flextable table when publishing it in an RMarkdown document.
The table has some merged columns. In the reproducible example, this is column 1.
In the sekwencja variable,...
4
votes
1
answer
99
views
Is it possible to make a flextable html output hoverable?
I am trying to mimic hoverablity effect like tables produced with kableExtra which creates a very appealing effect and was wondering if anyone has an idea how this may be doable with flextable.
Here's ...
3
votes
1
answer
94
views
Is it possible to fix the head for a long html flextable?
I am trying to have sticky headers like tables produced with kableExtra which is useful when inspecting long tables and was wondering if anyone has an idea how this may be doable with flextable.
Here'...
2
votes
2
answers
91
views
How to vertically merge more than one column based a factor column
Please help find a solution that allows one to merge multiple columns respective to a grouping column. In the reproducible example I want to merge columns v2 and v3 within the respective groups (a,b,c)...
0
votes
0
answers
67
views
Function as_flex_table() Corrupting Word File when Knitting
The function as_flex_table() is causing my Word files to be corrupted when I knit to Word using R Markdown, despite the code running fine within R Studio.
The following code knits to Word with no ...
1
vote
1
answer
59
views
Why do I get the wrong right border with add_header_row, colwith > 1 and save_as_image in my flextable?
In my flextable code I want to add a header row with colwiths > 1. When saving the flextable as an image, the right border gets double. Is it possible that this is a bug, or am I doing something ...
2
votes
2
answers
156
views
Method to set minimum column width in flextable
I'm looking for a way to apply autofit() only to columns that are too small.
This is my current method but I'm looking for a better way to do it:
library(flextable)
library(magrittr)
### Ex. Tbls
...
1
vote
1
answer
60
views
grouping a table and a ggplot object and export to pptx as a editable graphic (svg converted to a forms)
I want to produce a pptx slide like this:
library(ggplot2)
library(grid)
library(cowplot)
library(dplyr)
# remotes::install_github("davidgohel/flextable")
library(flextable)
gg1 <-...
0
votes
0
answers
155
views
Flextable corrupts .docx when knitted/printed from .rmd/.qmd
I am producing a corrupted .docx when including flextable in my workflow.
The below examples have previously worked.
I updated most packages and environments (VS code) and pandoc. I cannot quite ...
0
votes
0
answers
66
views
Customize flextable XML in Word documents using officer and flextable with new versions
I've extensively worked with older versions of the officer and flextable packages in R to create Word documents with tables. To achieve custom table formatting beyond the packages' default ...
1
vote
1
answer
86
views
GitLab CI/CD: apt-get Fails to Locate System Packages with r-base:latest Image [closed]
I'm trying to deploy an R Shiny app using GitLab CI/CD and publish it to Posit Connect. My goal is simple—I just want my GitLab pipeline to run my Shiny app (app.R) and deploy it.
I have very limited ...
2
votes
1
answer
75
views
flextable causing error in papaja pdf output
When rendering a flextable in a papaja document the following error is produced:
55 words in text body
0 words in reference section
tlmgr: package repository https://ftp.snt.utwente.nl/pub/software/...
1
vote
1
answer
107
views
flextable adding a new column when using tbl_stack in gtsummary
I'm using tbl_stack to combine two tables and I have a group header for each table.
It looks fine when I view the table in R - however, when I export the document to .docx format, flextable is adding ...
0
votes
1
answer
103
views
Width of flextable in pdf do not show in full the column names
I have the following rmarkdown document in R that generates a flextable object.
My problem is that the two columns 4 and 5 the header names do not show in full and the last letters are hidden.
---
...
0
votes
0
answers
69
views
Render multiple data frame with flextable do not show
I have a data frame in R called data and looks like this:
library(tibble)
library(flextable)
library(dplyr)
# Create a tibble
data <- tibble(
country = c("USA", "Canada", &...
1
vote
1
answer
109
views
How can I output multiple flextable objects in R Markdown
Does anyone know if it is possible to loop through a list that varies in length of arguments to input into a custom function that outputs a flextable object in a word document using R Markdown? This ...
0
votes
1
answer
83
views
Conditional coloring in the Flextable in R
I have tibble (data frame) in R called table_factors that
at the end will be a flextable. I want to conditionally color the columns Results based on multiple and complex condition.
For example the ...
0
votes
0
answers
122
views
How do I create a table using flextable in R with a horizontal scroll with customised width settings
I using flextable to produce tables in html format. I have a table with long text in some cells and so would like to increase the column width, but width() and autofit() only increase column widths up ...
0
votes
1
answer
133
views
Font color in flextable text
I have a tibble in R that has text (string) in the 3rd column that its cells has character and number.I want the number only to be colored but the text to remain black.
Is that possible to do that in ...
1
vote
2
answers
301
views
How do I change cell text color in flextable based on a string?
In Flextable, I'm trying to change the color of the text in a cell if it detects a "+" (green) or "-" (red). The help guide is really clear on how to do this for numeric data, but ...
1
vote
0
answers
120
views
Rows are disappearing after conversion using as_flextable
I'm encountering an issue with the flextable package in R. I have a data frame (elements_table) with 12 rows. However, when I create a flextable using as_flextable(elements_table), the resulting table ...
1
vote
1
answer
75
views
Header font and merge vertically in flextable in R
I have a data frame in R called df :
library(tidyverse)
library(officer)
library(flextable)
df = df%>%
arrange(
Category,
factor(Favor, levels = c("Bad", "Mediocre", ...
3
votes
1
answer
85
views
Conflict between flextable, ggplot2, and Arabic & Hindi
I'm having trouble getting ggplot2 to work with Arabic and Hindi when flextable is loaded.
Here's a first run that also includes English and Russian to demonstrate that everything works without ...
1
vote
3
answers
87
views
Caption is ignored when using as_raster function
Is there a way to include set_caption in a flextable object when you are adding it to a ggplot plot? In the following example, the caption "Table of iris" is dropped using flextable::...
2
votes
1
answer
159
views
Created consistent caption formatting between figures and flextables in Rmd HTML output
I am having trouble getting my captions for figures and tables having consistent formatting when knitting a Rmd file to HTML output from the Bookdown package. I have tried applying different methods ...
0
votes
1
answer
52
views
Looped RMarkdown Render with flextable Fails if Variables are Included in Table Conditional Formatting when Parallelized
I use loops to render .docx reports from an .rmd template that includes flextable tables with conditional formatting. I finally figured out how parallelization in R works (kind of), and I tried to ...
2
votes
1
answer
194
views
flextable: I want to remove second level header [closed]
I am pretty new to R and trying to format a flextable. I would like to remove the second level header altogether (blue arrow).
I would like to remove the second level of the header. I've created the ...
1
vote
1
answer
74
views
How to set different cell properties for different lines of multi-line header in flextable?
How can I take a multi-header flextable and give different background, text, or other properties to different lines of the header?
For example, say I have this table:
library(tidyverse)
library(...
0
votes
1
answer
390
views
How can I write a latex chunk inside an R chunk in Rmarkdown?
I want to create a PDF file with several instances of two side-by-side flextables. For this, I want to be able to use a loop, since I want all different flextables to have different input, provided ...
3
votes
0
answers
112
views
How to have flextable display a multi-line equation involving fractions
I would like to display this in a cell of a flextable:
I'm working in an RMarkdown document that will Knit to Word. From my research, equations in flextables can either be rendered by writing in ...
1
vote
2
answers
116
views
R flextable proc_freq remove counts
I want to show a crosstab of two variables in a flextable, but only show row/column/table percentages, not counts.
For example, if I run the collowing code
library(flextable)
proc_freq(
mtcars,
&...
0
votes
0
answers
165
views
How to rearrange columns in Flextable?
I am encountering the following problem: Whenever I use Flextable to display my data, the Variables column always comes on the right even though in the original dataset it is on the left.
I even tried ...
1
vote
1
answer
161
views
Is there a way to get separate N and % columns using gtsummary and flextable?
I am making a descriptive table of categorical variables. gtsummary::tbl_summary combined with as_flextable and my own flextable adjustments gives me the APA-formatted table I want, with frequencies ...
1
vote
0
answers
102
views
flextable crashing when calling as_flextable() or labelizor() functions
I tried to create a flextable, but it would always stop with an error.
Here an example from the flextable documentation (labelizor help page):
library(flextable)
z <- summarizor(
x = CO2[-c(1, ...
0
votes
1
answer
55
views
Why is Row Percentage Still Showing in Flextable?
Despite using (what I believe to be) sufficient code to remove all percentages, they are still showing up in my flextable. If only attaining frequency for 1 variable, does the package simply require ...
1
vote
0
answers
78
views
Issue with out.width not affecting image size in officedown::rdocx_document
I am trying to generate a Word document with R using the officedown::rdocx_document output format. When I use the standard output: word_document option, I can easily control the size of images in the ...
-1
votes
1
answer
61
views
Colour body of flextable [closed]
I am piping data into the following in the hope to put a blue table around my data where am I going wrong?
|>
flextable::flextable() |>
colors(color = 'blue',part = "body")
I ...
0
votes
1
answer
397
views
Flextable does not work anymore in quarto documents - Error: ! package or namespace load failed for 'flextable' [closed]
I love flextable and so I use it in a lot of projects.
After setup of a new Laptop where I installed R 4.4.1 and RStudio 2024.04.2 I had to see that
the flextable library (0.9.6) produces an error ...
3
votes
2
answers
289
views
Flextable conditional formatting based on a variable not shown in the output
I have a flextable that I am trying to conditionally format based on a variable that will not be shown in the output. Here are some dummy data:
library(tidyverse)
library(flextable)
set.seed(12345)
#...
1
vote
1
answer
138
views
Changing colors within my footer in flextable
I have certain words in my flextable footer lines that I would like to be a different color. Here is an example using the example iris data.
library(flextable)
ft_1 <- flextable(head(iris))
ft_1 &...