Reputation: 31
I'm trying to set number of significant digits inside the summary_rows() function to format mean and sd outputs as following:
library(gt)
library(tidyverse)
iris %>%
gt(groupname_col = "Species") %>%
summary_rows(
groups = TRUE,
columns = c(Sepal.Length:Petal.Width),
fns = list(
Mean = "mean",
SD = "sd"),
formatter = fmt_number(n_sigfig = 1))
But returns that argument "data" is missing. Any idea?
Thanks!
Upvotes: 1
Views: 215
Reputation: 671
according to the documentation are the '...' for additional parameters of the formatter:
library(gt)
library(tidyverse)
iris %>%
gt(groupname_col = "Species") %>%
summary_rows(
groups = TRUE,
columns = c(Sepal.Length:Petal.Width),
fns = list(
Mean = "mean",
SD = "sd"),
formatter = fmt_number, n_sigfig = 1)
Upvotes: 1