From f0976772c2bf5d2599b101ba7b636fa543af96fa Mon Sep 17 00:00:00 2001 From: kartikeya kirar Date: Tue, 27 Feb 2024 14:18:53 +0530 Subject: [PATCH] pre-release `tm_a_regression` document update (#655) part of https://github.com/insightsengineering/teal.modules.general/issues/624 --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- R/tm_a_regression.R | 39 +++++++++++++++++++++++---------------- man/tm_a_regression.Rd | 29 +++++++++++++++++++---------- 2 files changed, 42 insertions(+), 26 deletions(-) diff --git a/R/tm_a_regression.R b/R/tm_a_regression.R index 26f3180ba..e3dd0bfd3 100644 --- a/R/tm_a_regression.R +++ b/R/tm_a_regression.R @@ -1,20 +1,29 @@ -#' Scatterplot and Regression Model -#' @md +#' Scatterplot and regression model +#' +#' Module for visualizing regression analysis, including scatterplots and +#' various regression diagnostics plots. +#' It allows users to explore the relationship between a set of regressors and a response variable, +#' visualize residuals, and identify outliers. +#' +#' @note For more examples, please see the vignette "Using regression plots" via +#' `vignette("using-regression-plots", package = "teal.modules.general")`. #' #' @inheritParams teal::module #' @inheritParams shared_params #' @param regressor (`data_extract_spec` or `list` of multiple `data_extract_spec`) -#' Regressor variables from an incoming dataset with filtering and selecting. +#' Regressor variables from an incoming dataset with filtering and selecting. #' @param response (`data_extract_spec` or `list` of multiple `data_extract_spec`) -#' Response variables from an incoming dataset with filtering and selecting. -#' @param alpha optional, (`numeric`) If scalar then the plot points will have a fixed opacity. If a -#' slider should be presented to adjust the plot point opacity dynamically then it can be a vector of -#' length three with `c(value, min, max)`. -#' @param size optional, (`numeric`) If scalar then the plot point sizes will have a fixed size -#' If a slider should be presented to adjust the plot point sizes dynamically then it can be a -#' vector of length three with `c(value, min, max)`. -#' @param default_outlier_label optional, (`character`) The default column selected to label outliers. -#' @param default_plot_type optional, (`numeric`) Defaults to Response vs Regressor. +#' Response variables from an incoming dataset with filtering and selecting. +#' @param alpha (`integer(1)` or `integer(3)`, optional) Specifies point opacity. +#' - When the length of `alpha` is one: the plot points will have a fixed opacity. +#' - When the length of `alpha` is three: the plot points opacity are dynamically adjusted based on +#' vector of `value`, `min`, and `max`. +#' @param size (`integer(1)` or `integer(3)`, optional) Specifies point size. +#' - When the length of `size` is one: the plot point sizes will have a fixed size. +#' - When the length of `size` is three: the plot points size are dynamically adjusted based on +#' vector of `value`, `min`, and `max`. +#' @param default_outlier_label (`character`, optional) The default column selected to label outliers. +#' @param default_plot_type (`numeric`, optional) Defaults to Response vs Regressor. #' 1. Response vs Regressor #' 2. Residuals vs Fitted #' 3. Normal Q-Q @@ -26,9 +35,6 @@ #' @templateVar ggnames `r regression_names` #' @template ggplot2_args_multi #' -#' @note For more examples, please see the vignette "Using regression plots" via -#' `vignette("using-regression-plots", package = "teal.modules.general")`. -#' #' @examples #' # general data example #' library(teal.widgets) @@ -189,6 +195,7 @@ tm_a_regression <- function(label = "Regression Analysis", ) } +# UI function for the regression module ui_a_regression <- function(id, ...) { ns <- NS(id) args <- list(...) @@ -276,7 +283,7 @@ ui_a_regression <- function(id, ...) { ) } - +# Server function for the regression module srv_a_regression <- function(id, data, reporter, diff --git a/man/tm_a_regression.Rd b/man/tm_a_regression.Rd index 100cdaeab..5d539d163 100644 --- a/man/tm_a_regression.Rd +++ b/man/tm_a_regression.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/tm_a_regression.R \name{tm_a_regression} \alias{tm_a_regression} -\title{Scatterplot and Regression Model} +\title{Scatterplot and regression model} \usage{ tm_a_regression( label = "Regression Analysis", @@ -36,13 +36,19 @@ Response variables from an incoming dataset with filtering and selecting.} \item{plot_width}{optional, (\code{numeric}) Specifies the plot width as a three-element vector of \code{value}, \code{min}, and \code{max} for a slider encoding the plot width.} -\item{alpha}{optional, (\code{numeric}) If scalar then the plot points will have a fixed opacity. If a -slider should be presented to adjust the plot point opacity dynamically then it can be a vector of -length three with \code{c(value, min, max)}.} +\item{alpha}{(\code{integer(1)} or \code{integer(3)}, optional) Specifies point opacity. +\itemize{ +\item When the length of \code{alpha} is one: the plot points will have a fixed opacity. +\item When the length of \code{alpha} is three: the plot points opacity are dynamically adjusted based on +vector of \code{value}, \code{min}, and \code{max}. +}} -\item{size}{optional, (\code{numeric}) If scalar then the plot point sizes will have a fixed size -If a slider should be presented to adjust the plot point sizes dynamically then it can be a -vector of length three with \code{c(value, min, max)}.} +\item{size}{(\code{integer(1)} or \code{integer(3)}, optional) Specifies point size. +\itemize{ +\item When the length of \code{size} is one: the plot point sizes will have a fixed size. +\item When the length of \code{size} is three: the plot points size are dynamically adjusted based on +vector of \code{value}, \code{min}, and \code{max}. +}} \item{ggtheme}{optional, (\code{character}) \code{ggplot2} theme to be used by default. Defaults to \code{"gray"}.} @@ -61,7 +67,7 @@ with text placed before the output to put the output into context. For example a \item{post_output}{(\code{shiny.tag}, optional) Text or UI element to be displayed after the module's output, adding context or further instructions. Elements like \code{shiny::helpText()} are useful.} -\item{default_plot_type}{optional, (\code{numeric}) Defaults to Response vs Regressor. +\item{default_plot_type}{(\code{numeric}, optional) Defaults to Response vs Regressor. \enumerate{ \item Response vs Regressor \item Residuals vs Fitted @@ -72,10 +78,13 @@ adding context or further instructions. Elements like \code{shiny::helpText()} a \item Cook's dist vs Leverage }} -\item{default_outlier_label}{optional, (\code{character}) The default column selected to label outliers.} +\item{default_outlier_label}{(\code{character}, optional) The default column selected to label outliers.} } \description{ -Scatterplot and Regression Model +Module for visualizing regression analysis, including scatterplots and +various regression diagnostics plots. +It allows users to explore the relationship between a set of regressors and a response variable, +visualize residuals, and identify outliers. } \note{ For more examples, please see the vignette "Using regression plots" via