Skip to content

Commit

Permalink
New arguments digits and table.font.size added to ggsummarystats #341
Browse files Browse the repository at this point in the history
  • Loading branch information
kassambara committed Sep 30, 2020
1 parent fb88d77 commit 74ebbf1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

## Minor changes

- Arguments (`digits` and `table.font.size`) added to `ggsummarystats()` for changing the summary table decimal place and text size (#341).
- Now, the x-axis tick label names correctly align with the corresponding ticks when the rotation angle of the texts is set to 90. This is automatically achieved by setting internally `vjust = 0.5` (#301).

## Bug fixes
Expand Down
10 changes: 7 additions & 3 deletions R/ggsummarystats.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ NULL
#' @inheritParams ggboxplot
#' @param digits integer indicating the number of decimal places (round) to be
#' used.
#' @param table.font.size the summary table font size.
#' @param position Position adjustment, either as a string, or the result of a
#' call to a position adjustment function.
#' @param summaries summary stats to display in the table. Possible values are
Expand Down Expand Up @@ -131,7 +132,8 @@ ggsummarystats <- function(data, x, y, summaries = c("n", "median", "iqr"),
ggfunc = ggboxplot,
color = "black", fill = "white", palette = NULL,
facet.by = NULL, free.panels = FALSE, labeller = "label_value",
heights = c(0.80, 0.20), ggtheme = theme_pubr(), ...) {
heights = c(0.80, 0.20), digits = 0, table.font.size = 3,
ggtheme = theme_pubr(), ...) {
if (missing(ggtheme) & !is.null(facet.by)) {
ggtheme <- theme_pubr(border = TRUE)
}
Expand Down Expand Up @@ -201,7 +203,8 @@ ggsummarystats_core <- function(data, x, y, summaries = c("n", "median", "iqr"),
ggfunc = ggboxplot,
color = "black", fill = "white", palette = NULL,
ggtheme = theme_pubr(), heights = c(0.80, 0.20),
facet.by = NULL, free.panels = FALSE, labeller = "label_value", ...) {
facet.by = NULL, free.panels = FALSE, labeller = "label_value",
digits = 0, table.font.size = 3,...) {
groups <- c(x, color, fill, facet.by) %>%
unique() %>%
intersect(colnames(data))
Expand All @@ -224,7 +227,8 @@ ggsummarystats_core <- function(data, x, y, summaries = c("n", "median", "iqr"),
x = x, y = summaries,
color = color, palette = palette, legend = "none",
ggtheme = ggtheme,
facet.by = table.facet.by, labeller = labeller
facet.by = table.facet.by, labeller = labeller,
digits = digits, size = table.font.size
) +
clean_table_theme()

Expand Down
4 changes: 4 additions & 0 deletions man/ggsummarystats.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 74ebbf1

Please sign in to comment.