Skip to content

[Bug]: The order of statistics in tm_outliers summary table is random #735

Open
@m7pr

Description

@m7pr

What happened?

The order of statistics in a drop-down menu is as follows

 [1] "Qn1" "Qn2" "Qn3" "Qc1" "Qc2" "Qc3" "Mn1" "Mn2" "Mn3" "Mc1" "Mc2" "Mc3"

but the order that is displayed is a bit random

Qn1 Qn2 Qn3 Qc1 Qc3 Qc2 Mn3 Mn2 Mn1 Mc2 Mc3 Mc1
image

Code to reproduce

library(teal)
library(teal.modules.general)
app_driver_tm_outlier <- function() {
  data <- teal.data::teal_data()
  data <- within(data, {
    CO2 <- CO2 # nolint: object_name
    CO2[["primary_key"]] <- seq_len(nrow(CO2))
  })
  teal.data::datanames(data) <- "CO2"
  teal.data::join_keys(data) <- teal.data::join_keys(join_key("CO2", "CO2", "primary_key"))

  vars <- teal.transform::choices_selected(teal.transform::variable_choices(data[["CO2"]], c("Plant", "Type", "Treatment")))

  init_teal_app_driver(
    data = data,
    modules = tm_outliers(
      outlier_var = list(
        teal.transform::data_extract_spec(
          dataname = "CO2",
          select = teal.transform::select_spec(
            label = "Select variable:",
            choices = teal.transform::variable_choices(data[["CO2"]], c("conc", "uptake")),
            selected = "uptake",
            multiple = FALSE,
            fixed = FALSE
          )
        )
      ),
      categorical_var = list(
        teal.transform::data_extract_spec(
          dataname = "CO2",
          filter = teal.transform::filter_spec(
            vars = vars,
            choices = teal.transform::value_choices(data[["CO2"]], vars$selected),
            selected = teal.transform::value_choices(data[["CO2"]], vars$selected),
            multiple = TRUE
          )
        )
      ),
      ggplot2_args = list(
        teal.widgets::ggplot2_args(
          labs = list(subtitle = "Plot generated by Outliers Module")
        )
      )
    )
  )
}
app_driver <- app_driver_tm_outlier()
app_driver$open_url()

sessionInfo()

No response

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct.

Contribution Guidelines

  • I agree to follow this project's Contribution Guidelines.

Security Policy

  • I agree to follow this project's Security Policy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcore

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions