Skip to content

Commit

Permalink
Rename group/group_by arguments into by (#872)
Browse files Browse the repository at this point in the history
* easystats/easystats#404

* fix data_grid

* fix split_by

* fix

* Update test-marginaleffects.R

* fix

* lintr
  • Loading branch information
strengejacke authored May 16, 2024
1 parent bb37b89 commit 849db1e
Show file tree
Hide file tree
Showing 20 changed files with 479 additions and 451 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: insight
Title: Easy Access to Model Information for Various Model Objects
Version: 0.19.11
Version: 0.19.11.1
Authors@R:
c(person(given = "Daniel",
family = "Lüdecke",
Expand Down
12 changes: 12 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# insight 0.19.12

## Breaking

* Arguments named `group`, `at`, `group_by` and `split_by` will be deprecated
in future releases of _easystats_ packages. Please use `by` instead. This
affects following functions in *insight*:

* `export_table()`
* `get_datagrid()`
* `print_parameters()`

# insight 0.19.11

## General
Expand Down
19 changes: 13 additions & 6 deletions R/export_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
#' the second and third, right-align column four and left-align the fifth
#' column. For HTML-tables, may be one of `"center"`, `"left"` or
#' `"right"`.
#' @param group_by Name of column in `x` that indicates grouping for tables.
#' Only applies when `format = "html"`. `group_by` is passed down
#' to `gt::gt(groupname_col = group_by)`.
#' @param by Name of column in `x` that indicates grouping for tables.
#' Only applies when `format = "html"`. `by` is passed down to
#' `gt::gt(groupname_col = by)`.
#' @param width Refers to the width of columns (with numeric values). Can be
#' either `NULL`, a number or a named numeric vector. If `NULL`, the width for
#' each column is adjusted to the minimum required width. If a number, columns
Expand All @@ -48,6 +48,7 @@
#' if `table_width` is numeric and table rows are larger than `table_width`,
#' the table is split into two parts.
#' @param ... Currently not used.
#' @param group_by Deprecated, please use `by` instead.
#' @inheritParams format_value
#' @inheritParams get_data
#'
Expand Down Expand Up @@ -116,7 +117,8 @@ export_table <- function(x,
subtitle = NULL,
footer = NULL,
align = NULL,
group_by = NULL,
by = NULL,
group_by = NULL, ## TODO: deprecate later
zap_small = FALSE,
table_width = NULL,
verbose = TRUE,
Expand All @@ -131,6 +133,11 @@ export_table <- function(x,
format <- "markdown"
}

## TODO: deprecate later
if (!is.null(group_by)) {
by <- group_by
}

# validation check
if (is.null(x) || (is.data.frame(x) && nrow(x) == 0) || is_empty_object(x)) {
if (isTRUE(verbose)) {
Expand Down Expand Up @@ -191,7 +198,7 @@ export_table <- function(x,
subtitle = subtitle,
footer = footer,
align = align,
group_by = group_by,
group_by = by,
zap_small = zap_small,
empty_line = empty_line,
indent_groups = indent_groups,
Expand Down Expand Up @@ -263,7 +270,7 @@ export_table <- function(x,
subtitle = attributes(i)$table_subtitle,
footer = t_footer,
align = align,
group_by = group_by,
group_by = by,
zap_small = zap_small,
empty_line = empty_line,
indent_groups = indent_groups,
Expand Down
Loading

0 comments on commit 849db1e

Please sign in to comment.