Skip to content

Commit cb07cce

Browse files
averissimovedhav
andauthored
pre-release tm_g_response document update (#666)
part of #624 ~blocked by #651~ --------- Signed-off-by: André Veríssimo <211358+averissimo@users.noreply.github.com> Co-authored-by: Vedha Viyash <49812166+vedhav@users.noreply.github.com>
1 parent b6f0d28 commit cb07cce

File tree

2 files changed

+65
-33
lines changed

2 files changed

+65
-33
lines changed

R/tm_g_response.R

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,43 @@
1-
#' Response Plots
2-
#' @md
1+
#' Response plot module
2+
#'
3+
#' Generates a response plot for a given `response` and `x` variables.
4+
#' This module allows users customize and add annotations to the plot depending
5+
#' on the module's arguments.
6+
#' It supports showing the counts grouped by other variable facets (by row / column),
7+
#' swapping the coordinates, show count annotations and displaying the response plot
8+
#' as frequency or density.
39
#'
410
#' @inheritParams teal::module
511
#' @inheritParams shared_params
612
#' @param response (`data_extract_spec` or `list` of multiple `data_extract_spec`)
7-
#' Which variable to use as the response. You can define one fixed column by using the
8-
#' setting `fixed = TRUE` inside the `select_spec`.
9-
#' `data_extract_spec` must not allow multiple selection in this case.
13+
#' Which variable to use as the response.
14+
#' You can define one fixed column by setting `fixed = TRUE` inside the `select_spec`.
15+
#'
16+
#' The `data_extract_spec` must not allow multiple selection in this case.
1017
#' @param x (`data_extract_spec` or `list` of multiple `data_extract_spec`)
11-
#' Which variable to use on the X-axis of the response plot. Allow the user to select multiple
12-
#' columns from the `data` allowed in teal.
13-
#' `data_extract_spec` must not allow multiple selection in this case.
14-
#' @param row_facet optional, (`data_extract_spec` or `list` of multiple `data_extract_spec`)
15-
#' Which data columns to use for faceting rows.
16-
#' @param col_facet optional, (`data_extract_spec` or `list` of multiple `data_extract_spec`)
17-
#' Which data to use for faceting columns.
18-
#' @param coord_flip optional, (`logical`) Whether to flip coordinates between `x` and `response`.
19-
#' @param count_labels optional, (`logical`) Whether to show count labels.
20-
#' Defaults to `TRUE`.
21-
#' @param freq optional, (`logical`) Whether to display frequency (`TRUE`) or density (`FALSE`).
22-
#' Defaults to density (`FALSE`).
18+
#' Specifies which variable to use on the X-axis of the response plot.
19+
#' Allow the user to select multiple columns from the `data` allowed in teal.
20+
#'
21+
#' The `data_extract_spec` must not allow multiple selection in this case.
22+
#' @param row_facet (`data_extract_spec` or `list` of multiple `data_extract_spec`)
23+
#' optional specification of the data variable(s) to use for faceting rows.
24+
#' @param col_facet (`data_extract_spec` or `list` of multiple `data_extract_spec`)
25+
#' optional specification of the data variable(s) to use for faceting columns.
26+
#' @param coord_flip (`logical(1)`)
27+
#' Indicates whether to flip coordinates between `x` and `response`.
28+
#' The default value is `FALSE` and it will show the `x` variable on the x-axis
29+
#' and the `response` variable on the y-axis.
30+
#' @param count_labels (`logical(1)`)
31+
#' Indicates whether to show count labels.
32+
#' Defaults to `TRUE`.
33+
#' @param freq (`logical(1)`)
34+
#' Indicates whether to display frequency (`TRUE`) or density (`FALSE`).
35+
#' Defaults to density (`FALSE`).
36+
#'
37+
#' @inherit shared_params return
2338
#'
2439
#' @note For more examples, please see the vignette "Using response plot" via
25-
#' \code{vignette("using-response-plot", package = "teal.modules.general")}.
40+
#' `vignette("using-response-plot", package = "teal.modules.general")`.
2641
#'
2742
#' @examples
2843
#' # general data example
@@ -195,6 +210,7 @@ tm_g_response <- function(label = "Response Plot",
195210
)
196211
}
197212

213+
# UI function for the response module
198214
ui_g_response <- function(id, ...) {
199215
ns <- NS(id)
200216
args <- list(...)
@@ -270,6 +286,7 @@ ui_g_response <- function(id, ...) {
270286
)
271287
}
272288

289+
# Server function for the response module
273290
srv_g_response <- function(id,
274291
data,
275292
reporter,

man/tm_g_response.Rd

Lines changed: 30 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)