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.

The package provides functions to make it easy to create and style tables in the programming language. Like the grammar of graphics for data visualization (see ), the philosophy behind is to provide a grammar of tables.

An overview and introduction to the package can be found on the package website.

429 questions
0
votes
1 answer

Printing gt table with rmarkdown::render when chunk code is in an external file

I have monthly report generator that works fine with gt table inside a chunk, but not when the code for the chunk has a external source like the example below. the main script rmarkdown::render('report.Rmd', output_file = paste0('report_', i,…
jcarlos
  • 425
  • 7
  • 17
0
votes
1 answer

Text transform issue inserting image in a gt table

I had previously asked about inserting images in gt tables here and gotten a lot of help. But I am now encountering a new issue. The difficult part is that I am having trouble creating a minimal example. Consider this code from the answer to my…
jerH
  • 1,085
  • 1
  • 12
  • 30
0
votes
1 answer

How to use Javascript correctly to target gt table row elements in Shiny

I am making a shiny app with a gt table. I would like to make text in the .gt_group_heading class bold if capitalized. It seems any text passed to this element is created within the td tag as pure text and not recognized as HTML. So I was thinking…
mdb_ftl
  • 423
  • 2
  • 14
0
votes
1 answer

R gt summary_row but no new column

I am using the GT() Package to make a very simple table. df <- data.frame( Size = c("Small", "Medium", "Large"), Sold = c(1000, 2000, 3000) ) df %>% gt() %>% fmt_number( columns = vars(Sold), sep_mark = ",", drop_trailing_zeros…
EvilEmi
  • 49
  • 3
0
votes
1 answer

maintaining gt conditional color formatting in shiny selection

I'm building a shiny app of NBA players and field goal%. The app will return a gt table of the selected players. The issue I'm having is that the conditional formatting doesn't hold for the population as it re-adjusted to the selected players from…
user3585829
  • 945
  • 11
  • 24
0
votes
1 answer

Why the Conditional Color Styling inside the Reactable is not working?

Data df <- tibble( x = rep(paste0( "del", 1:10 ), 100), y = rep(paste0( "topic", 1:5 ), 200), z = paste0("question", 1:1000), w = 1:1000 ) Code reactable( df, groupBy = c("x", "y"), columns = list( w = colDef( aggregate =…
0
votes
1 answer

How do I display my months in ascending order (Jan, Feb, Mar) through a gt table in R?

I have my two chunks of code below. In the first chunk I am trying to get my data ready to display in a gt table. My goal is to display a table with Month abbreviations in ascending order (Jan, Feb, March, etc.) in column 1. Currently, it appears…
0
votes
1 answer

add a background color to the "Overall" column in gtsummary table

How can I use tab_style() to add a background color to the "Overall" column? library(gtsummary) trial %>% select(trt, age, grade, response) %>% tbl_summary(by=trt) %>% add_overall() %>% as_gt()
Eric Green
  • 7,385
  • 11
  • 56
  • 102
0
votes
1 answer

Create a function using gt package to display tick & cross against approved & non approved customers in R?

I am new in R & have created some Classification models. By using those I need to display tick & cross against approved and rejected customers based Class column. I picked up a piece of code from somewhere that helps in creating star Ratings against…
ViSa
  • 1,563
  • 8
  • 30
0
votes
1 answer

R change number of significant figures in a gt table by replacing values from another column

I am trying to create a series of gt tables with values shown to a 3rd sig fig. Because I want to show non numeric characters, the column I want to display is a factor. What's the best way to do this? I thought I could replace the values of a factor…
bartski
  • 35
  • 8
0
votes
1 answer

cols_label in gt table inside function

is there a solution to have column names in cols_label as strings? Like fun <- function( df,column, label ) { df %>% gt() %>% cols_label( column = label) } fun( mtcars,"cyl", "cylinder")
jcarlos
  • 425
  • 7
  • 17
0
votes
2 answers

Adding a filter to a gt table for sorting R

I am looking for a way to add a filter to a gt table that can be used for sorting each column. I have seen similar functionality for data tables, but have been unsuccessful finding an option for gt (possibly because it's a relatively new package).…
bodega18
  • 596
  • 2
  • 13
0
votes
1 answer

r shiny reactive gtsummary table

After I fixed the rendering problem of {gtsummary} with your help: How to use {gtsummary} package in r shiny app !thanks to stefan again, I try to construct reactivity in my app. After construction of the summary table with {gtsummary} I would like…
TarJae
  • 72,363
  • 6
  • 19
  • 66
0
votes
0 answers

R, how to export a gt as a metafile

I have a datatable such as this one : library(stringi) library(tidyverse) library(data.table) MWE <- data.table("Zone"=stri_rand_strings(9, 10, pattern = "[A-Za-z0-9]")) %>% .[,paste0("Var",2:11):= round(rnorm(9,2,4),1)] From that I want to…
Anthony Martin
  • 767
  • 1
  • 9
  • 28
0
votes
0 answers

why gt::gt() replace all spaces in the column name of my raw dataset with "." in RStudio?

As title, I want the output of "corresponding question" column same as the raw dataset, but it replaces all spaces in that column with "." The code I use are: raw= read.csv("DATA2X02 class survey 2020 (Responses) - Form responses 1.csv", na=c("n/a",…
Regina
  • 5
  • 2
1 2 3
28
29