Skip to main content

Questions tagged [gt]

Use this tag for questions related to the gt package. The gt package provides functions to make it easy to create and style tables in the R programming language.

1 vote
1 answer
37 views

How do I target the `gtsummary::as_gt()` columns in `gt` styling functions?

I use gtsummary::as_gt() to style summary tables using gt functions. For styling functions such as gt::cols_width() and gt::tab_style(), one needs to know how the columns of the table are named. This ...
Lukas D. Sauer's user avatar
1 vote
1 answer
27 views

How to wrap text in a `gt::as_latex()` table

When using the R package gt to generate a LaTeX table, wrapping of very long column entries does not happen. I tried several options in tab_style(), but they did not have any effect on indentation: ---...
Lukas D. Sauer's user avatar
1 vote
1 answer
38 views

gt color based on color strings from a column

I have been looking for the simplest, most direct way of colorizing a column based on the color string value (i.e. red or #FF0000) within a {gt} table. library(gt) df <- data.frame( name = c(&...
Michaël Weber's user avatar
1 vote
1 answer
74 views

How to create a table that spans multiple pages with Quarto and Typst

I am using Quarto, Typst, and R. I'm creating a table with gt. Currently if I create a table that is too long then it gets clipped (see below image) This is what my R code block looks like. As ...
Matthew Tansley's user avatar
2 votes
1 answer
39 views

Numbered tables using `gt` package in Rmarkdown with pdf output

When rendering a Rmarkdown file to pdf using the bookdown::pdf_document2 output, how can I obtain a table with a numbered caption (e.g. Table 1: caption) when rendering a table with the gt package ? ...
A. Bohyn's user avatar
  • 165
0 votes
1 answer
45 views

How can I export a gt table to Word while retaining formatting in RStudio?

I've generated a formatted table in RStudio using the gt package, and I'm ready to export it. My issue is that when I run the gtsave() function and specify that my output file is a .docx file, I ...
Mary Rachel's user avatar
0 votes
0 answers
25 views

Greek letters in labels with `gt`-tables for PDF documents

Is there a way of using Greek letters in column labels for tables produced with gt when the output is a PDF document? Minimal example using Quarto to render: --- format: pdf --- ```{r} #| echo: false ...
Stefan Hansen's user avatar
0 votes
0 answers
26 views

spanners in interactive gt tables

When using the gt package, spanners disappear when I make the table interactive with opt_interactive(). How do I keep the spanner? As a simple example, I use mtcars with an intended spanner. When ...
user25719676's user avatar
1 vote
1 answer
43 views

Rendering Quarto document with multiple gt tables printed via purrr::map

I’m encountering an issue with rendering tables in my Quarto Markdown document. I’m using walk and map to generate tables with a custom function, but instead of displaying the tables, only the HTML ...
Erik De Luca's user avatar
2 votes
3 answers
67 views

Is there a way to make the bars' colors conditional to the column?

I would like to make the colors of the bars in the column "Percentile" conditional to the value, meaning that if the value is between 100-90 it has one color, if it's between 90-80 it's ...
Lucas Varela's user avatar
0 votes
0 answers
24 views

R gt package: How to perform line breaking respecting indentation [duplicate]

When a a string does not fit in a gt table cell (due to cell width) it will break to the 2nd line. However when indentation is used on the cell content then the 2nd line is not indented. Is there a ...
missuse's user avatar
  • 19.5k
0 votes
0 answers
13 views

Using superscript for ‘grouped by’ variable with gt()

I am trying to add superscript (units) for each level of a variable in a gt() table. I’m able to do it easily for columns using cols_units() however it isn’t applying to the column that is being ...
Henry's user avatar
  • 1
0 votes
1 answer
26 views

How to access the "heading" in the list of an Anova output

I want to find a way to take the summary output from anova(model) and put it into a table. I haven't been able to find any ways to do this so I am just doing it manually using gt() and data.frames. My ...
computer_goblin's user avatar
1 vote
0 answers
29 views

gt table not appear in for loop function after render to word

im trying to render a gt table into word file using quarto. but the result does not appear as a table. is there any way to fix this? below is my code and screenshot of word output ` tbl_smry <- ...
mal's user avatar
  • 11
0 votes
0 answers
32 views

GT table with R - Is it possible to use tab_spanner or something similar for an Interactive table

I am using GT table a lot, and want to make these tables interactive. But when using tab_spanner for two or more columns and setting opt_interactive(active = TRUE), the spanner is gone. Does anyone ...
Hdmas's user avatar
  • 11

15 30 50 per page
1
2 3 4 5
35