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

Tidyeval in a non-quasiquotation context (psych::describeBy(group))

I am trying to make a function that will return a gt table of the results of the common psych::describe() and psych::describeBy() functions. the problem is that describeBy() expects the group argument to be of the form data$vector rather than just…
Andrew McCartney
  • 191
  • 2
  • 10
0
votes
1 answer

Transposing a table for use with gt::gt()

I'd like to pipe gt at the end of this command but the function creates a list, which is not allowed in gt() Error in UseMethod("group_vars"): no applicable method for 'group_vars' applied to an object of class "c('matrix', 'array', 'list')"` test…
ibm
  • 744
  • 7
  • 14
0
votes
1 answer

In RMarkdown How to insert linebreaks inside a loop to print gt tables

I'm trying to generate blank lines within a loop containing an H2 header and a table created by the gt package. In the first example outside the loop we can see that "", the bar followed by two spaces produces the desired effect, but how to achieve…
jcarlos
  • 425
  • 7
  • 17
0
votes
2 answers

R gt summary_rows Ratio Total Row

I am using the great gt package to help make nice looking tables in R. I really like how I can use it to make Total columns, but I am struggling in trying to do anything beyond a simple sum or mean. I need do something more like a SUMPRODUCT for a…
Nick Criswell
  • 1,733
  • 2
  • 16
  • 32
0
votes
1 answer

Labeling columns in gt table using loop

I would like to create a generic table generation function using gt that labels the columns in the passed datatable, but I can't figure out a way to get the gt cols_label step to allow me to loop over columns. Any tips? Here's my code: dtExample =…
rks13
  • 33
  • 4
-1
votes
2 answers

How can I merge grouped values in one column in R?

If I have a table that looks like this: How can I merge each group in Column 1 so that the values are not repeated like this: I also need this to work with the gt table library I have tried df %>% group_by(Column 1) %>% gt(), but that puts the…
TomJones
  • 15
  • 3
-1
votes
2 answers

No rmarkdown PDF output for summary_rows gt table

I'm trying to create a table with the gt package that I want to output to PDF. The code works fine and looks good in RStudio, but in the rendered PDF there is no output for summary_rows(). --- title: "Untitled" author: "author" date:…
FilipW
  • 1,412
  • 1
  • 13
  • 25
-1
votes
1 answer

gt table coloring full column with row filter

Has anyone had the following issue with gt table? Regardless of the value I set for the tab style row argument the whole column gets hit with the color argument. I only want the "Paid Per Episode" column to color it blue when it is greater than…
Bjc51192
  • 327
  • 2
  • 10
-2
votes
2 answers

Fill cells with value = 0 with Red color

I have a table: and i need to fill cells with value = 0 with red color. I realize i need data_color but how to set palette with 2 colors? red if value==0 , white if value<>0 ? I've found an example: data_color( columns =…
Maxim
  • 301
  • 1
  • 9
1 2 3
28
29