Skip to content

Commit

Permalink
teal.data::datanames() is deprecated in favor of dot-prefix and `na…
Browse files Browse the repository at this point in the history
  • Loading branch information
averissimo authored Nov 8, 2024
1 parent e67d7f2 commit 3c9bcb4
Show file tree
Hide file tree
Showing 50 changed files with 124 additions and 218 deletions.
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ Depends:
ggplot2 (>= 3.4.0),
R (>= 3.6),
shiny (>= 1.6.0),
teal (>= 0.15.2.9052),
teal.transform (>= 0.5.0)
teal (>= 0.15.2.9079),
teal.transform (>= 0.5.0.9015)
Imports:
checkmate (>= 2.1.0),
dplyr (>= 1.0.5),
Expand All @@ -42,8 +42,8 @@ Imports:
shinyWidgets (>= 0.5.1),
stats,
stringr (>= 1.4.1),
teal.code (>= 0.5.0),
teal.data (>= 0.5.0),
teal.code (>= 0.5.0.9012),
teal.data (>= 0.6.0.9015),
teal.logger (>= 0.2.0.9004),
teal.reporter (>= 0.3.0),
teal.widgets (>= 0.4.0),
Expand Down
5 changes: 1 addition & 4 deletions R/tm_a_pca.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
#' USArrests <- USArrests
#' })
#'
#' datanames(data) <- "USArrests"
#'
#' app <- init(
#' data = data,
#' modules = modules(
Expand Down Expand Up @@ -66,8 +64,7 @@
#' require(nestcolor)
#' ADSL <- rADSL
#' })
#' datanames(data) <- "ADSL"
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' app <- init(
#' data = data,
Expand Down
4 changes: 1 addition & 3 deletions R/tm_a_regression.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
#' require(nestcolor)
#' CO2 <- CO2
#' })
#' datanames(data) <- c("CO2")
#'
#' app <- init(
#' data = data,
Expand Down Expand Up @@ -98,8 +97,7 @@
#' require(nestcolor)
#' ADSL <- rADSL
#' })
#' datanames(data) <- "ADSL"
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' app <- init(
#' data = data,
Expand Down
6 changes: 2 additions & 4 deletions R/tm_data_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#' require(nestcolor)
#' iris <- iris
#' })
#' datanames(data) <- c("iris")
#'
#' app <- init(
#' data = data,
Expand Down Expand Up @@ -68,8 +67,7 @@
#' require(nestcolor)
#' ADSL <- rADSL
#' })
#' datanames(data) <- "ADSL"
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' app <- init(
#' data = data,
Expand Down Expand Up @@ -196,7 +194,7 @@ srv_page_data_table <- function(id,
if_filtered <- reactive(as.logical(input$if_filtered))
if_distinct <- reactive(as.logical(input$if_distinct))

datanames <- isolate(teal.data::datanames(data()))
datanames <- isolate(names(data()))
datanames <- Filter(function(name) {
is.data.frame(isolate(data())[[name]])
}, datanames)
Expand Down
1 change: 0 additions & 1 deletion R/tm_file_viewer.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#' data <- within(data, {
#' data <- data.frame(1)
#' })
#' datanames(data) <- c("data")
#'
#' app <- init(
#' data = data,
Expand Down
5 changes: 2 additions & 3 deletions R/tm_front_page.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
#' ADSL <- rADSL
#' attr(ADSL, "metadata") <- list("Author" = "NEST team", "data_source" = "synthetic data")
#' })
#' datanames(data) <- "ADSL"
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' table_1 <- data.frame(Info = c("A", "B"), Text = c("A", "B"))
#' table_2 <- data.frame(`Column 1` = c("C", "D"), `Column 2` = c(5.5, 6.6), `Column 3` = c("A", "B"))
Expand Down Expand Up @@ -169,7 +168,7 @@ srv_front_page <- function(id, data, tables, show_metadata) {
)

metadata_data_frame <- reactive({
datanames <- teal.data::datanames(data())
datanames <- names(data())
convert_metadata_to_dataframe(
lapply(datanames, function(dataname) attr(data()[[dataname]], "metadata")),
datanames
Expand Down
4 changes: 1 addition & 3 deletions R/tm_g_association.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#' factors <- names(Filter(isTRUE, vapply(CO2, is.factor, logical(1L))))
#' CO2[factors] <- lapply(CO2[factors], as.character)
#' })
#' datanames(data) <- c("CO2")
#'
#' app <- init(
#' data = data,
Expand Down Expand Up @@ -81,8 +80,7 @@
#' require(nestcolor)
#' ADSL <- rADSL
#' })
#' datanames(data) <- "ADSL"
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' app <- init(
#' data = data,
Expand Down
4 changes: 1 addition & 3 deletions R/tm_g_bivariate.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
#' require(nestcolor)
#' CO2 <- data.frame(CO2)
#' })
#' datanames(data) <- c("CO2")
#'
#' app <- init(
#' data = data,
Expand Down Expand Up @@ -116,8 +115,7 @@
#' require(nestcolor)
#' ADSL <- rADSL
#' })
#' datanames(data) <- c("ADSL")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' app <- init(
#' data = data,
Expand Down
10 changes: 4 additions & 6 deletions R/tm_g_distribution.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#' data <- within(data, {
#' iris <- iris
#' })
#' datanames(data) <- "iris"
#'
#' app <- init(
#' data = data,
Expand Down Expand Up @@ -68,8 +67,7 @@
#' data <- within(data, {
#' ADSL <- rADSL
#' })
#' datanames(data) <- c("ADSL")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' vars1 <- choices_selected(
#' variable_choices(data[["ADSL"]], c("ARM", "COUNTRY", "SEX")),
Expand Down Expand Up @@ -1216,15 +1214,15 @@ srv_distribution <- function(id,
# wrapped in if since could lead into validate error - we do want to continue
test_r_qenv_out <- try(test_q(), silent = TRUE)
if (!inherits(test_r_qenv_out, c("try-error", "error"))) {
qenv_final <- teal.code::join(qenv_final, test_q())
qenv_final <- c(qenv_final, test_q())
}

qenv_final <- if (tab == "Histogram") {
req(dist_q())
teal.code::join(qenv_final, dist_q())
c(qenv_final, dist_q())
} else if (tab == "QQplot") {
req(qq_q())
teal.code::join(qenv_final, qq_q())
c(qenv_final, qq_q())
}
qenv_final
})
Expand Down
4 changes: 1 addition & 3 deletions R/tm_g_response.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
#' mtcars[[v]] <- as.factor(mtcars[[v]])
#' }
#' })
#' datanames(data) <- "mtcars"
#'
#' app <- init(
#' data = data,
Expand Down Expand Up @@ -98,8 +97,7 @@
#' require(nestcolor)
#' ADSL <- rADSL
#' })
#' datanames(data) <- c("ADSL")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' app <- init(
#' data = data,
Expand Down
4 changes: 1 addition & 3 deletions R/tm_g_scatterplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
#' require(nestcolor)
#' CO2 <- CO2
#' })
#' datanames(data) <- "CO2"
#'
#' app <- init(
#' data = data,
Expand Down Expand Up @@ -133,8 +132,7 @@
#' require(nestcolor)
#' ADSL <- rADSL
#' })
#' datanames(data) <- c("ADSL")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' app <- init(
#' data = data,
Expand Down
4 changes: 1 addition & 3 deletions R/tm_g_scatterplotmatrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
#' profit = rnorm(50, 20, 10)
#' )
#' })
#' datanames(data) <- c("countries", "sales")
#' join_keys(data) <- join_keys(
#' join_key("countries", "countries", "id"),
#' join_key("sales", "sales", "id"),
Expand Down Expand Up @@ -117,8 +116,7 @@
#' ADSL <- rADSL
#' ADRS <- rADRS
#' })
#' datanames(data) <- c("ADSL", "ADRS")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' app <- init(
#' data = data,
Expand Down
15 changes: 7 additions & 8 deletions R/tm_missing_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#' mtcars[["cyl"]] <- as.factor(mtcars[["cyl"]])
#' mtcars[["gear"]] <- as.factor(mtcars[["gear"]])
#' })
#' datanames(data) <- c("iris", "mtcars")
#'
#' app <- init(
#' data = data,
Expand All @@ -64,8 +63,7 @@
#' ADSL <- rADSL
#' ADRS <- rADRS
#' })
#' datanames(data) <- c("ADSL", "ADRS")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' app <- init(
#' data = data,
Expand Down Expand Up @@ -173,10 +171,11 @@ srv_page_missing_data <- function(id, data, reporter, filter_panel_api, parent_d
moduleServer(id, function(input, output, session) {
teal.logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

datanames <- isolate(teal.data::datanames(data()))
datanames <- Filter(function(name) {
is.data.frame(isolate(data())[[name]])
}, datanames)
datanames <- isolate(names(data()))
datanames <- Filter(
function(name) is.data.frame(isolate(data())[[name]]),
datanames
)
if_subject_plot <- length(parent_dataname) > 0 && parent_dataname %in% datanames

ns <- session$ns
Expand Down Expand Up @@ -465,7 +464,7 @@ srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, par


data_parent_keys <- reactive({
if (length(parent_dataname) > 0 && parent_dataname %in% teal.data::datanames(data())) {
if (length(parent_dataname) > 0 && parent_dataname %in% names(data())) {
keys <- teal.data::join_keys(data())[[dataname]]
if (parent_dataname %in% names(keys)) {
keys[[parent_dataname]]
Expand Down
6 changes: 2 additions & 4 deletions R/tm_outliers.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#' CO2 <- CO2
#' CO2[["primary_key"]] <- seq_len(nrow(CO2))
#' })
#' datanames(data) <- "CO2"
#' join_keys(data) <- join_keys(join_key("CO2", "CO2", "primary_key"))
#'
#' vars <- choices_selected(variable_choices(data[["CO2"]], c("Plant", "Type", "Treatment")))
Expand Down Expand Up @@ -77,8 +76,7 @@
#' data <- within(data, {
#' ADSL <- rADSL
#' })
#' datanames(data) <- "ADSL"
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' fact_vars_adsl <- names(Filter(isTRUE, sapply(data[["ADSL"]], is.factor)))
#' vars <- choices_selected(variable_choices(data[["ADSL"]], fact_vars_adsl))
Expand Down Expand Up @@ -396,7 +394,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var,
})

# Used to create outlier table and the dropdown with additional columns
dataname_first <- isolate(teal.data::datanames(data())[[1]])
dataname_first <- isolate(names(data())[[1]])

common_code_q <- reactive({
req(iv_r()$is_valid())
Expand Down
4 changes: 1 addition & 3 deletions R/tm_t_crosstable.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#' }
#' mtcars[["primary_key"]] <- seq_len(nrow(mtcars))
#' })
#' datanames(data) <- "mtcars"
#' join_keys(data) <- join_keys(join_key("mtcars", "mtcars", "primary_key"))
#'
#' app <- init(
Expand Down Expand Up @@ -85,8 +84,7 @@
#' data <- within(data, {
#' ADSL <- rADSL
#' })
#' datanames(data) <- "ADSL"
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' app <- init(
#' data = data,
Expand Down
6 changes: 2 additions & 4 deletions R/tm_variable_browser.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#' faithful <- faithful
#' CO2 <- CO2
#' })
#' datanames(data) <- c("iris", "mtcars", "women", "faithful", "CO2")
#'
#' app <- init(
#' data = data,
Expand Down Expand Up @@ -65,8 +64,7 @@
#' ADSL <- rADSL
#' ADTTE <- rADTTE
#' })
#' datanames(data) <- c("ADSL", "ADTTE")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' app <- init(
#' data = data,
Expand Down Expand Up @@ -225,7 +223,7 @@ srv_variable_browser <- function(id,

varname_numeric_as_factor <- reactiveValues()

datanames <- isolate(teal.data::datanames(data()))
datanames <- isolate(names(data()))
datanames <- Filter(function(name) {
is.data.frame(isolate(data())[[name]])
}, datanames)
Expand Down
13 changes: 5 additions & 8 deletions man/tm_a_pca.Rd

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

Loading

0 comments on commit 3c9bcb4

Please sign in to comment.