Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ repos:
- tern
- tibble
- tidyr
- tidyselect
- utils

- id: spell-check
Expand Down
16 changes: 7 additions & 9 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ Authors@R: c(
person("Nikolas", "Burkoff", role = "aut"),
person("F. Hoffmann-La Roche AG", role = c("cph", "fnd"))
)
Description: Prebuilt 'shiny' modules containing tools for viewing data, visualizing data,
understanding missing and outlier values within your data and performing simple data analysis.
This extends 'teal' framework that supports reproducible research and analysis.
Description: Prebuilt 'shiny' modules containing tools for viewing data,
visualizing data, understanding missing and outlier values within your
data and performing simple data analysis. This extends 'teal'
framework that supports reproducible research and analysis.
License: Apache License 2.0
URL: https://insightsengineering.github.io/teal.modules.general/,
https://github.com/insightsengineering/teal.modules.general/
Expand All @@ -26,7 +27,6 @@ Depends:
ggplot2 (>= 3.4.0),
R (>= 3.6),
shiny (>= 1.6.0),
shinyTree,
teal (>= 0.14.0.9027),
teal.transform (>= 0.4.0.9011)
Imports:
Expand All @@ -36,21 +36,21 @@ Imports:
forcats (>= 1.0.0),
grid,
logger (>= 0.2.0),
magrittr (>= 1.5),
scales,
shinyjs,
shinyTree,
shinyvalidate,
shinyWidgets (>= 0.5.1),
stats,
stringr (>= 1.4.1),
teal.code (>= 0.4.1.9009),
teal.data (>= 0.3.0.9018),
teal.logger (>= 0.1.1),
teal.reporter (>= 0.2.0),
teal.widgets (>= 0.4.0),
tern (>= 0.7.10),
tibble (>= 2.0.0),
tidyr (>= 0.8.3),
tidyselect,
utils
Suggests:
broom (>= 0.7.10),
Expand All @@ -65,12 +65,10 @@ Suggests:
knitr (>= 1.42),
lattice (>= 0.18-4),
MASS,
methods,
nestcolor (>= 0.1.0),
rlang (>= 1.0.0),
rtables (>= 0.5.1),
sparkline,
teal.data (>= 0.3.0.9018),
testthat (>= 3.0.4)
VignetteBuilder:
knitr
Expand All @@ -82,7 +80,7 @@ Config/Needs/verdepcheck: haleyjeppson/ggmosaic, tidyverse/ggplot2,
insightsengineering/teal.code, insightsengineering/teal.logger,
insightsengineering/teal.reporter, insightsengineering/teal.transform,
insightsengineering/teal.widgets, insightsengineering/tern,
tidyverse/tibble, tidyverse/tidyr, r-lib/tidyselect, tidymodels/broom,
tidyverse/tibble, tidyverse/tidyr, tidymodels/broom,
daattali/colourpicker, daattali/ggExtra, aphalo/ggpmisc, aphalo/ggpp,
baddstats/goftest, gridExtra, ramnathv/htmlwidgets, jeroen/jsonlite,
yihui/knitr, deepayan/lattice, MASS, insightsengineering/nestcolor,
Expand Down
3 changes: 1 addition & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export(tm_variable_browser)
import(ggmosaic)
import(ggplot2)
import(shiny)
import(shinyTree)
import(teal)
import(teal.transform)
importFrom(magrittr,"%>%")
importFrom(dplyr,"%>%")
5 changes: 2 additions & 3 deletions R/teal.modules.general.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
#' @import ggplot2
#' @import ggmosaic
#' @import shiny
#' @import shinyTree
#' @import teal
#' @import teal.transform
#' @importFrom magrittr %>%
#' @importFrom dplyr %>%
#'
#'
#' @name teal.modules.general
Expand All @@ -19,7 +18,7 @@
# nolint start
# Note ggmosaic (version <= 0.3.3) needs to be in DEPENDS as the following does not work if it is imported
# df <- data.frame(x = c("A", "B", "C", "A"), y = c("Z", "Z", "W", "W"))
# ggplot(df) + ggmosaic::geom_mosaic(aes(x = ggmosaic::product(x), fill = y))
# ggplot(df) + ggmosaic::geom_mosaic(aes(x = ggmosaic::product(x), fill = y))
# nolint end

# Needed to avoid R CMD note on no visible binding
Expand Down
4 changes: 2 additions & 2 deletions R/tm_a_pca.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#'
#' data <- teal_data()
#' data <- within(data, {
#' library(nestcolor)
#' require(nestcolor)
#' USArrests <- USArrests
#' })
#' datanames(data) <- "USArrests"
Expand Down Expand Up @@ -61,7 +61,7 @@
#'
#' data <- teal_data()
#' data <- within(data, {
#' library(nestcolor)
#' require(nestcolor)
#' ADSL <- rADSL
#' })
#' datanames(data) <- "ADSL"
Expand Down
4 changes: 2 additions & 2 deletions R/tm_a_regression.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#'
#' data <- teal_data()
#' data <- within(data, {
#' library(nestcolor)
#' require(nestcolor)
#' CO2 <- CO2
#' })
#' datanames(data) <- c("CO2")
Expand Down Expand Up @@ -80,7 +80,7 @@
#'
#' data <- teal_data()
#' data <- within(data, {
#' library(nestcolor)
#' require(nestcolor)
#' ADSL <- rADSL
#' })
#' datanames(data) <- "ADSL"
Expand Down
6 changes: 3 additions & 3 deletions R/tm_data_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#'
#' data <- teal_data()
#' data <- within(data, {
#' library(nestcolor)
#' require(nestcolor)
#' iris <- iris
#' })
#' datanames(data) <- c("iris")
Expand All @@ -54,7 +54,7 @@
#' # CDISC data example
#' data <- teal_data()
#' data <- within(data, {
#' library(nestcolor)
#' require(nestcolor)
#' ADSL <- rADSL
#' })
#' datanames(data) <- "ADSL"
Expand Down Expand Up @@ -301,7 +301,7 @@ srv_data_table <- function(id,
teal::validate_has_data(df, min_nrow = 1L, msg = paste("data", dataname, "is empty"))

dataframe_selected <- if (if_distinct()) {
dplyr::count(df, dplyr::across(tidyselect::all_of(variables)))
dplyr::count(df, dplyr::across(dplyr::all_of(variables)))
} else {
df[variables]
}
Expand Down
2 changes: 1 addition & 1 deletion R/tm_front_page.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#'
#' data <- teal_data()
#' data <- within(data, {
#' library(nestcolor)
#' require(nestcolor)
#' ADSL <- teal.modules.general::rADSL
#' attr(ADSL, "metadata") <- list("Author" = "NEST team", "data_source" = "synthetic data")
#' })
Expand Down
4 changes: 2 additions & 2 deletions R/tm_g_association.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#'
#' data <- teal_data()
#' data <- within(data, {
#' library(nestcolor)
#' require(nestcolor)
#' CO2 <- CO2
#' factors <- names(Filter(isTRUE, vapply(CO2, is.factor, logical(1L))))
#' CO2[factors] <- lapply(CO2[factors], as.character)
Expand Down Expand Up @@ -69,7 +69,7 @@
#'
#' data <- teal_data()
#' data <- within(data, {
#' library(nestcolor)
#' require(nestcolor)
#' ADSL <- rADSL
#' })
#' datanames(data) <- "ADSL"
Expand Down
4 changes: 2 additions & 2 deletions R/tm_g_bivariate.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
#'
#' data <- teal_data()
#' data <- within(data, {
#' library(nestcolor)
#' require(nestcolor)
#' CO2 <- data.frame(CO2)
#' })
#' datanames(data) <- c("CO2")
Expand Down Expand Up @@ -112,7 +112,7 @@
#'
#' data <- teal_data()
#' data <- within(data, {
#' library(nestcolor)
#' require(nestcolor)
#' ADSL <- rADSL
#' })
#' datanames(data) <- c("ADSL")
Expand Down
4 changes: 2 additions & 2 deletions R/tm_g_response.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#'
#' data <- teal_data()
#' data <- within(data, {
#' library(nestcolor)
#' require(nestcolor)
#' mtcars <- mtcars
#' for (v in c("cyl", "vs", "am", "gear")) {
#' mtcars[[v]] <- as.factor(mtcars[[v]])
Expand Down Expand Up @@ -78,7 +78,7 @@
#'
#' data <- teal_data()
#' data <- within(data, {
#' library(nestcolor)
#' require(nestcolor)
#' ADSL <- rADSL
#' })
#' datanames(data) <- c("ADSL")
Expand Down
4 changes: 2 additions & 2 deletions R/tm_g_scatterplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#'
#' data <- teal_data()
#' data <- within(data, {
#' library(nestcolor)
#' require(nestcolor)
#' CO2 <- CO2
#' })
#' datanames(data) <- "CO2"
Expand Down Expand Up @@ -128,7 +128,7 @@
#'
#' data <- teal_data()
#' data <- within(data, {
#' library(nestcolor)
#' require(nestcolor)
#' ADSL <- rADSL
#' })
#' datanames(data) <- c("ADSL")
Expand Down
18 changes: 9 additions & 9 deletions R/tm_missing_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#' # general example data
#' data <- teal_data()
#' data <- within(data, {
#' library(nestcolor)
#' require(nestcolor)
#'
#' add_nas <- function(x) {
#' x[sample(seq_along(x), floor(length(x) * runif(1, .05, .17)))] <- NA
Expand Down Expand Up @@ -56,7 +56,7 @@
#' # CDISC example data
#' data <- teal_data()
#' data <- within(data, {
#' library(nestcolor)
#' require(nestcolor)
#' ADSL <- rADSL
#' ADRS <- rADRS
#' })
Expand Down Expand Up @@ -640,7 +640,7 @@ srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, par
substitute(
expr = summary_plot_obs <- data_frame_call[, analysis_vars] %>%
dplyr::summarise_all(list(function(x) sum(is.na(x)))) %>%
tidyr::pivot_longer(tidyselect::everything(), names_to = "col", values_to = "n_na") %>%
tidyr::pivot_longer(dplyr::everything(), names_to = "col", values_to = "n_na") %>%
dplyr::mutate(n_not_na = nrow(ANL) - n_na) %>%
tidyr::pivot_longer(-col, names_to = "isna", values_to = "n") %>%
dplyr::mutate(isna = isna == "n_na", n_pct = n / nrow(ANL) * 100),
Expand Down Expand Up @@ -733,7 +733,7 @@ srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, par
summary_plot_patients <- ANL[, c(parent_keys, analysis_vars)] %>%
dplyr::group_by_at(parent_keys) %>%
dplyr::summarise_all(anyNA) %>%
tidyr::pivot_longer(cols = !tidyselect::all_of(parent_keys), names_to = "col", values_to = "anyna") %>%
tidyr::pivot_longer(cols = !dplyr::all_of(parent_keys), names_to = "col", values_to = "anyna") %>%
dplyr::group_by_at(c("col")) %>%
dplyr::summarise(count_na = sum(anyna)) %>%
dplyr::mutate(count_not_na = ndistinct_subjects - count_na) %>%
Expand Down Expand Up @@ -1041,7 +1041,7 @@ srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, par

summary_data <- dplyr::summarise_all(summary_data, summ_fn) %>%
dplyr::mutate(group_var_name := paste0(group_var, ":", group_var_name, "(N=", count_data$n, ")")) %>%
tidyr::pivot_longer(!tidyselect::all_of(group_var), names_to = "Variable", values_to = "out") %>%
tidyr::pivot_longer(!dplyr::all_of(group_var), names_to = "Variable", values_to = "out") %>%
tidyr::pivot_wider(names_from = group_var, values_from = "out") %>%
dplyr::mutate(`Variable label` = create_cols_labels(Variable, just_label = TRUE), .after = Variable)
},
Expand All @@ -1056,7 +1056,7 @@ srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, par
substitute(
expr = summary_data <- ANL %>%
dplyr::summarise_all(summ_fn) %>%
tidyr::pivot_longer(tidyselect::everything(),
tidyr::pivot_longer(dplyr::everything(),
names_to = "Variable",
values_to = paste0("Missing (N=", nrow(ANL), ")")
) %>%
Expand Down Expand Up @@ -1119,7 +1119,7 @@ srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, par
# order subjects by decreasing number of missing and then by
# missingness pattern (defined using sha1)
order_subjects <- summary_plot_patients %>%
dplyr::select(-"id", -tidyselect::all_of(parent_keys)) %>%
dplyr::select(-"id", -dplyr::all_of(parent_keys)) %>%
dplyr::transmute(
id = dplyr::row_number(),
number_NA = apply(., 1, sum),
Expand All @@ -1130,7 +1130,7 @@ srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, par

# order columns by decreasing percent of missing values
ordered_columns <- summary_plot_patients %>%
dplyr::select(-"id", -tidyselect::all_of(parent_keys)) %>%
dplyr::select(-"id", -dplyr::all_of(parent_keys)) %>%
dplyr::summarise(
column = create_cols_labels(colnames(.)),
na_count = apply(., MARGIN = 2, FUN = sum),
Expand All @@ -1139,7 +1139,7 @@ srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, par
dplyr::arrange(na_percent, dplyr::desc(column))

summary_plot_patients <- summary_plot_patients %>%
tidyr::gather("col", "isna", -"id", -tidyselect::all_of(parent_keys)) %>%
tidyr::gather("col", "isna", -"id", -dplyr::all_of(parent_keys)) %>%
dplyr::mutate(col = create_cols_labels(col))
})
) %>%
Expand Down
4 changes: 2 additions & 2 deletions man/tm_a_pca.Rd

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

4 changes: 2 additions & 2 deletions man/tm_a_regression.Rd

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

4 changes: 2 additions & 2 deletions man/tm_data_table.Rd

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

2 changes: 1 addition & 1 deletion man/tm_front_page.Rd

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

Loading