Closed mafw closed 7 months ago
@rich-iannone . I can't reproduce this issue now with gt 0.10.1, R 4.3.2, latest RStudio, Windows.
Edit: there is a small typo in the reprex. (should not have 'groups = TRUE`).
But I can't reproduce the error and the output of gtsave(exibble_c, "exibble_c.docx")
is fine.
docx rtf
Thank you @olivroy for the repro testing here. Must have been fixed somewhere down the line. Given everything is good here, I will close the issue.
Oops. Mistake @rich-iannone, there are 2 typos in the example that prevent actually correctly generating the error.
# Create a gt table using the `exibble` dataset
library(gt)
library(dplyr)
exibble_a <-
exibble %>%
select(-c(fctr, date, time, datetime)) %>%
gt::gt(rowname_col = "row", groupname_col = "group") %>%
sub_missing()
# Create summary row
exibble_b <-
exibble_a %>%
summary_rows(
#groups = TRUE, # typo in the reprex
columns = num,
fns = list(
average = "mean",
total = "sum",
SD = "sd")
)
# Relabel columns
exibble_c <-
exibble_b %>%
cols_label(
num = "Number"
)
# Prints nicely
exibble_c
# Fails to save
gtsave(exibble_c, "exibble_c.rtf") # typos in the reprex.
#> Error in `dplyr::all_of()`:
#> ! Can't subset columns that don't exist.
#> ✖ Column `Number` doesn't exist.
Created on 2024-02-22 with reprex v2.1.0
Probably an easy fix to provide a named vector to all_of()
.
Description
If I relabel the columns in a table with summary rows using
cols_label
, the output fromgtsave
is wonky. If I output to .docx columns are shifted to the right. If i output to .rtf I get an error message fromdplyr::select
saying that the relabelled column doesn't exist.Reproducible example
Session info