Skip to content

Commit f164561

Browse files
committed
Merge remote-tracking branch 'origin/pre-release@main' into 686-assertions_process@pre-release@main
* origin/pre-release@main: removed @nord tags and added return from shared_params missing comma 641 non exported functions (#680) pre-release vignettes review (#681) [skip roxygen] [skip vbump] Roxygen Man Pages Auto Update Standardise function titles similar to what we have in tmc (#691) [skip actions] Bump version to 0.2.16.9026 `tm_g_regression` labels are no longer allowed out of bounds (#675) [skip actions] Bump version to 0.2.16.9025 Remove the internal function `var_labels` in favour of `teal.data::col_labels` (#690) [skip actions] Bump version to 0.2.16.9024 Fix the silent error in `tm_a_pca` (#688)
2 parents 4e3f7fc + 87f6eee commit f164561

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+2555
-2498
lines changed

.lintr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
linters: linters_with_defaults(
22
line_length_linter = line_length_linter(120),
33
cyclocomp_linter = NULL,
4-
object_usage_linter = NULL
4+
object_usage_linter = NULL,
5+
object_name_linter = object_name_linter(styles = c("snake_case", "symbols"), regexes = c(ANL = "^ANL_?[0-9]*$", ADaM = "^r?AD[A-Z]{2,3}_?[0-9]*$"))
56
)

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ repos:
2424
- dplyr
2525
- DT
2626
- forcats
27+
- ggrepel
2728
- grid
2829
- logger
2930
- scales

DESCRIPTION

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Type: Package
22
Package: teal.modules.general
33
Title: General Modules for 'teal' Applications
4-
Version: 0.2.16.9023
5-
Date: 2024-02-22
4+
Version: 0.2.16.9026
5+
Date: 2024-02-27
66
Authors@R: c(
77
person("Dawid", "Kaledkowski", , "dawid.kaledkowski@roche.com", role = c("aut", "cre")),
88
person("Pawel", "Rucki", , "pawel.rucki@roche.com", role = "aut"),
@@ -59,6 +59,7 @@ Suggests:
5959
ggExtra,
6060
ggpmisc (>= 0.4.3),
6161
ggpp,
62+
ggrepel,
6263
goftest,
6364
gridExtra,
6465
htmlwidgets,
@@ -84,9 +85,10 @@ Config/Needs/verdepcheck: haleyjeppson/ggmosaic, tidyverse/ggplot2,
8485
insightsengineering/teal.widgets, insightsengineering/tern,
8586
tidyverse/tibble, tidyverse/tidyr, tidymodels/broom,
8687
daattali/colourpicker, daattali/ggExtra, aphalo/ggpmisc, aphalo/ggpp,
87-
baddstats/goftest, gridExtra, ramnathv/htmlwidgets, jeroen/jsonlite,
88-
yihui/knitr, deepayan/lattice, MASS, insightsengineering/nestcolor,
89-
r-lib/rlang, insightsengineering/rtables, htmlwidgets/sparkline,
88+
slowkow/ggrepel, baddstats/goftest, gridExtra, ramnathv/htmlwidgets,
89+
jeroen/jsonlite, yihui/knitr, deepayan/lattice, MASS,
90+
insightsengineering/nestcolor, r-lib/rlang,
91+
insightsengineering/rtables, sparkline, insightsengineering/teal.data,
9092
r-lib/testthat
9193
Config/Needs/website: insightsengineering/nesttemplate
9294
Encoding: UTF-8

NEWS.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
# teal.modules.general 0.2.16.9023
1+
# teal.modules.general 0.2.16.9026
22

33
### Enhancements
44

55
* Updated the package docs and vignettes with the new way of specifying data for `teal::init()`. The `data` argument will accept a `teal_data` object
66

7+
### Bug fixes
8+
9+
* Outlier labels no longer appear out of bounds in `tm_a_regression`.
10+
711
### Miscellaneous
812

913
* Removed `teal.slice` dependencies.

R/tm_a_pca.R

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#' Principal component analysis module
1+
#' `teal` module: Principal component analysis
22
#'
33
#' Module conducts principal component analysis (PCA) on a given dataset and offers different
44
#' ways of visualizing the outcomes, including elbow plot, circle plot, biplot, and eigenvector plot.
@@ -9,19 +9,15 @@
99
#' @inheritParams shared_params
1010
#' @param dat (`data_extract_spec` or `list` of multiple `data_extract_spec`)
1111
#' specifying columns used to compute PCA.
12-
#' @param alpha (`numeric`, optional) Specifies point opacity.
13-
#' - If vector of `length == 1` then the plot points will have a fixed opacity.
14-
#' - while vector of `value`, `min`, and `max` allows dynamic adjustment.
15-
#' @param size (`numeric`, optional) Specifies point size.
16-
#' - If vector of `length == 1` then the plot point sizes will have a fixed size
17-
#' - while vector of `value`, `min`, and `max` allows dynamic adjustment.
1812
#' @param font_size (`numeric`, optional) Specifies font size.
1913
#' It controls the font size for plot titles, axis labels, and legends.
2014
#' - If vector of `length == 1` then the font sizes will have a fixed size.
2115
#' - while vector of `value`, `min`, and `max` allows dynamic adjustment.
2216
#' @templateVar ggnames "Elbow plot", "Circle plot", "Biplot", "Eigenvector plot"
2317
#' @template ggplot2_args_multi
2418
#'
19+
#' @inherit shared_params return
20+
#'
2521
#' @examples
2622
#' library(teal.widgets)
2723
#'
@@ -306,11 +302,10 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
306302
response[[i]]$select$multiple <- FALSE
307303
response[[i]]$select$always_selected <- NULL
308304
response[[i]]$select$selected <- NULL
309-
response[[i]]$select$choices <- teal.data::col_labels(isolate(data())[[response[[i]]$dataname]])
310-
response[[i]]$select$choices <- setdiff(
311-
response[[i]]$select$choices,
312-
unlist(teal.data::join_keys(isolate(data()))[[response[[i]]$dataname]])
313-
)
305+
all_cols <- teal.data::col_labels(isolate(data())[[response[[i]]$dataname]])
306+
ignore_cols <- unlist(teal.data::join_keys(isolate(data()))[[response[[i]]$dataname]])
307+
color_cols <- all_cols[!names(all_cols) %in% ignore_cols]
308+
response[[i]]$select$choices <- choices_labeled(names(color_cols), color_cols)
314309
}
315310

316311
selector_list <- teal.transform::data_extract_multiple_srv(

R/tm_data_table.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#' Data table viewer module
1+
#' `teal` module: Data table viewer
22
#'
33
#' Module provides a dynamic and interactive way to view `data.frame`s in a `teal` application.
44
#' It uses the `DT` package to display data tables in a paginated, searchable, and sortable format,
@@ -27,6 +27,8 @@
2727
#' @param server_rendering (`logical`) should the data table be rendered server side
2828
#' (see `server` argument of [DT::renderDataTable()])
2929
#'
30+
#' @inherit shared_params return
31+
#'
3032
#' @examples
3133
#' # general data example
3234
#' data <- teal_data()

R/tm_file_viewer.R

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#' File viewer module
1+
#' `teal` module: File viewer
22
#'
33
#' The file viewer module provides a tool to view static files.
44
#' Supported formats include text formats, `PDF`, `PNG` `APNG`,
@@ -8,18 +8,20 @@
88
#' @inheritParams shared_params
99
#' @param input_path (`list`) of the input paths, optional. Each element can be:
1010
#'
11-
#' 1. Specific path to files of accepted formats
12-
#' 2. A directory or a URL
11+
#' @inherit shared_params return
1312
#'
14-
#' The paths can be specified as absolute paths or relative to the running
15-
#' directory of the application.
13+
#' Paths can be specified as absolute paths or relative to the running directory of the application.
1614
#' Default to the current working directory if not supplied.
1715
#'
18-
#' @inherit shared_params return
19-
#'
2016
#' @examples
17+
#' data <- teal_data()
18+
#' data <- within(data, {
19+
#' data <- data.frame(1)
20+
#' })
21+
#' datanames(data) <- c("data")
22+
#'
2123
#' app <- init(
22-
#' data = teal_data(data = 1), # Mock dataset to initialize the app without error
24+
#' data = data,
2325
#' modules = modules(
2426
#' tm_file_viewer(
2527
#' input_path = list(
@@ -34,6 +36,7 @@
3436
#' if (interactive()) {
3537
#' shinyApp(app$ui, app$server)
3638
#' }
39+
#'
3740
#' @export
3841
#'
3942
tm_file_viewer <- function(label = "File Viewer Module",

R/tm_front_page.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#' Front page module
1+
#' `teal` module: Front page
22
#'
33
#' Creates a simple front page for `teal` applications, displaying
44
#' introductory text, tables, additional `html` or `shiny` tags, and footnotes.
@@ -15,17 +15,17 @@
1515
#' element, if named the name is shown first in bold, followed by the value.
1616
#' @param show_metadata (`logical`) indicating whether the metadata of the datasets be available on the module.
1717
#'
18-
#' @examples
18+
#' @inherit shared_params return
1919
#'
20+
#' @examples
2021
#' data <- teal_data()
2122
#' data <- within(data, {
2223
#' require(nestcolor)
23-
#' ADSL <- teal.modules.general::rADSL
24+
#' ADSL <- rADSL
2425
#' attr(ADSL, "metadata") <- list("Author" = "NEST team", "data_source" = "synthetic data")
2526
#' })
26-
#' datanames <- c("ADSL")
27-
#' datanames(data) <- datanames
28-
#' join_keys(data) <- default_cdisc_join_keys[datanames]
27+
#' datanames(data) <- "ADSL"
28+
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
2929
#'
3030
#' table_1 <- data.frame(Info = c("A", "B"), Text = c("A", "B"))
3131
#' table_2 <- data.frame(`Column 1` = c("C", "D"), `Column 2` = c(5.5, 6.6), `Column 3` = c("A", "B"))
@@ -40,7 +40,7 @@
4040
#' app <- init(
4141
#' data = data,
4242
#' modules = modules(
43-
#' teal.modules.general::tm_front_page(
43+
#' tm_front_page(
4444
#' header_text = c(
4545
#' "Important information" = "It can go here.",
4646
#' "Other information" = "Can go here."

R/tm_g_association.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#' Stack plots of variables and show association with reference variable
1+
#' `teal` module: Stack plots of variables and show association with reference variable
22
#'
33
#' Module provides functionality for visualizing the distribution of variables and
44
#' their association with a reference variable.
@@ -23,6 +23,8 @@
2323
#' @templateVar ggnames "Bivariate1", "Bivariate2"
2424
#' @template ggplot2_args_multi
2525
#'
26+
#' @inherit shared_params return
27+
#'
2628
#' @examples
2729
#' library(teal.widgets)
2830
#'

R/tm_g_bivariate.R

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#' Univariate and bivariate visualizations module
1+
#' `teal` module: Univariate and bivariate visualizations
22
#'
33
#' Module enables the creation of univariate and bivariate plots,
44
#' facilitating the exploration of data distributions and relationships between two variables.
@@ -44,10 +44,12 @@
4444
#' Does not allow scaling to be changed by default (`FALSE`).
4545
#' @param swap_axes (`logical`, optional) Whether to swap X and Y axes. Defaults to `FALSE`.
4646
#'
47+
#' @inherit shared_params return
48+
#'
4749
#' @examples
4850
#' library(teal.widgets)
4951
#'
50-
#' # general data exapmle
52+
#' # general data example
5153
#' data <- teal_data()
5254
#' data <- within(data, {
5355
#' require(nestcolor)
@@ -299,9 +301,7 @@ tm_g_bivariate <- function(label = "Bivariate Plots",
299301
)
300302
}
301303

302-
# UI function for the bivariate module.
303-
#' @noRd
304-
#' @keywords internal
304+
# UI function for the bivariate module
305305
ui_g_bivariate <- function(id, ...) {
306306
args <- list(...)
307307
is_single_dataset_value <- teal.transform::is_single_dataset(
@@ -442,9 +442,7 @@ ui_g_bivariate <- function(id, ...) {
442442
)
443443
}
444444

445-
# Server function for the bivariate module.
446-
#' @noRd
447-
#' @keywords internal
445+
# Server function for the bivariate module
448446
srv_g_bivariate <- function(id,
449447
data,
450448
reporter,
@@ -726,8 +724,6 @@ srv_g_bivariate <- function(id,
726724
}
727725

728726
# Get Substituted ggplot call
729-
#' @noRd
730-
#' @keywords internal
731727
bivariate_plot_call <- function(data_name,
732728
x = character(0),
733729
y = character(0),
@@ -778,8 +774,6 @@ bivariate_plot_call <- function(data_name,
778774

779775
# Create ggplot part of plot call
780776
# Due to the type of the x and y variable the plot type is chosen
781-
#' @noRd
782-
#' @keywords internal
783777
bivariate_ggplot_call <- function(x_class = c("NULL", "numeric", "integer", "factor", "character", "logical"),
784778
y_class = c("NULL", "numeric", "integer", "factor", "character", "logical"),
785779
freq = TRUE,
@@ -963,9 +957,7 @@ bivariate_ggplot_call <- function(x_class = c("NULL", "numeric", "integer", "fac
963957
plot_call
964958
}
965959

966-
#' Create facet call
967-
#' @noRd
968-
#' @keywords internal
960+
# Create facet call
969961
facet_ggplot_call <- function(row_facet = character(0),
970962
col_facet = character(0),
971963
free_x_scales = FALSE,
@@ -996,8 +988,6 @@ facet_ggplot_call <- function(row_facet = character(0),
996988
}
997989
}
998990

999-
#' @noRd
1000-
#' @keywords internal
1001991
coloring_ggplot_call <- function(colour,
1002992
fill,
1003993
size,

0 commit comments

Comments
 (0)