Skip to content

Commit

Permalink
Run styler
Browse files Browse the repository at this point in the history
  • Loading branch information
NeuroShepherd committed Jul 20, 2024
1 parent 70dbb21 commit 6d4d585
Show file tree
Hide file tree
Showing 23 changed files with 254 additions and 230 deletions.
5 changes: 3 additions & 2 deletions R/app_server.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ app_server <- function(input, output, session) {
add_row <- mod_row_add_server("row_add_1")
delete_row <- mod_row_delete_server("row_delete_1")
data_entered_probs <- mod_data_entry_server("data_entry_1",
add_row = add_row,
delete_row = delete_row)
add_row = add_row,
delete_row = delete_row
)
data_entered_iters <- mod_iterations_server("iterations_1")
data_entered_sample_size <- mod_sample_size_server("sample_size_1")
data_entered_tests <- mod_select_tests_server("select_tests_1")
Expand Down
2 changes: 1 addition & 1 deletion R/app_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ app_ui <- function(request) {
mod_downloads_page_ui("downloads_page_1"),
nav_spacer(),
!!!mod_navbar_extras_ui("navbar_extras_1")
)
)
)
}

Expand Down
1 change: 0 additions & 1 deletion R/assign_groups.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#'
assign_groups <- function(sample_size, sample_prob, prob0, prob1, seed,
.rng_kind = NULL, .rng_normal_kind = NULL, .rng_sample_kind = NULL) {

Check warning on line 21 in R/assign_groups.R

View workflow job for this annotation

GitHub Actions / lint

file=R/assign_groups.R,line=21,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 95 characters.

Check warning on line 21 in R/assign_groups.R

View workflow job for this annotation

GitHub Actions / lint

file=R/assign_groups.R,line=21,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 95 characters.

assertthat::assert_that(
length(prob0) == length(prob1),
msg = "prob0 and prob1 must have the same length"
Expand Down
1 change: 0 additions & 1 deletion R/mod_data_entry.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ mod_data_entry_ui <- function(id) {
tagList(
rhandsontable::rHandsontableOutput(ns("hottable"))
)

}

#' data_entry Server Functions
Expand Down
11 changes: 4 additions & 7 deletions R/mod_distributions_page.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#' @noRd
#'
#' @importFrom shiny NS tagList
mod_distributions_page_ui <- function(id){
mod_distributions_page_ui <- function(id) {
ns <- NS(id)
nav_panel(
"Results and Plots",
Expand All @@ -32,7 +32,7 @@ mod_distributions_page_ui <- function(id){
nav_panel(
"Core Inputs",
layout_column_wrap(
width = 1/2,
width = 1 / 2,
heights_equal = "row",
card(
markdown("Confidence Intervals"),
Expand All @@ -55,19 +55,16 @@ mod_distributions_page_ui <- function(id){
title = "Results",
!!!mod_plot_distributions_ui("plot_distributions_1")[["output_data"]]
)

)

)
}

#' distributions_page Server Functions
#'
#' @noRd
mod_distributions_page_server <- function(id){
moduleServer( id, function(input, output, session){
mod_distributions_page_server <- function(id) {
moduleServer(id, function(input, output, session) {
ns <- session$ns

})
}

Expand Down
21 changes: 11 additions & 10 deletions R/mod_downloads_page.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,48 +7,49 @@
#' @noRd
#'
#' @importFrom shiny NS tagList
mod_downloads_page_ui <- function(id){
mod_downloads_page_ui <- function(id) {
ns <- NS(id)
nav_panel(
title = "Report & Downloads",

layout_columns(
col_widths = c(2, 10, 2),
fillable = TRUE,
card(
card_header(
"Update and Download Report", class = "bg-dark"
"Update and Download Report",
class = "bg-dark"
),
fill = TRUE,
mod_report_generator_ui("report_generator_1")[["update_report"]],
mod_report_generator_ui("report_generator_1")[["download_report"]]
),
card(
card_header(
"Report", class = "bg-dark"
"Report",
class = "bg-dark"
),
fill = TRUE,
mod_report_generator_ui("report_generator_1")[["rendered_report"]]
),
),
card(
card_header(
"Download Data", class = "bg-dark"
"Download Data",
class = "bg-dark"
),
fill = TRUE,
mod_save_data_ui("save_data_1")[["save_rds"]],
mod_save_data_ui("save_data_1")[["save_excel"]]
),
)
)
)
}

#' downloads_page Server Functions
#'
#' @noRd
mod_downloads_page_server <- function(id){
moduleServer( id, function(input, output, session){
mod_downloads_page_server <- function(id) {
moduleServer(id, function(input, output, session) {
ns <- session$ns

})
}

Expand Down
12 changes: 6 additions & 6 deletions R/mod_homepage.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
#' @importFrom shiny NS tagList
mod_homepage_ui <- function(id) {
ns <- NS(id)
nav_panel(
"Home",
card(
title = "OrdinalSimR",
includeHTML(system.file("homepage.html", package = "ordinalsimr"))
)
nav_panel(
"Home",
card(
title = "OrdinalSimR",
includeHTML(system.file("homepage.html", package = "ordinalsimr"))
)
)
}

#' homepage Server Functions
Expand Down
53 changes: 27 additions & 26 deletions R/mod_navbar_extras.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,43 @@
#' @noRd
#'
#' @importFrom shiny NS tagList
mod_navbar_extras_ui <- function(id){
mod_navbar_extras_ui <- function(id) {
ns <- NS(id)

list(
nav_item(
tags$a(
shiny::icon("book-open-reader"),
"Docs",
href = "https://neuroshepherd.github.io/ordinalsimr/",
target = "_blank")
),
nav_item(
tags$a(
shiny::icon("circle-exclamation"),
"Issues",
href = "https://github.com/neuroshepherd/ordinalsimr/issues",
target = "_blank")
),
nav_item(
tags$a(
shiny::icon("github"),
"GitHub",
href = "https://github.com/neuroshepherd/ordinalsimr",
target = "_blank")
list(
nav_item(
tags$a(
shiny::icon("book-open-reader"),
"Docs",
href = "https://neuroshepherd.github.io/ordinalsimr/",
target = "_blank"
)
),
nav_item(
tags$a(
shiny::icon("circle-exclamation"),
"Issues",
href = "https://github.com/neuroshepherd/ordinalsimr/issues",
target = "_blank"
)
),
nav_item(
tags$a(
shiny::icon("github"),
"GitHub",
href = "https://github.com/neuroshepherd/ordinalsimr",
target = "_blank"
)
)

)
}

#' navbar_extras Server Functions
#'
#' @noRd
mod_navbar_extras_server <- function(id){
moduleServer( id, function(input, output, session){
mod_navbar_extras_server <- function(id) {
moduleServer(id, function(input, output, session) {
ns <- session$ns

})
}

Expand Down
55 changes: 31 additions & 24 deletions R/mod_plot_distributions.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ mod_plot_distributions_ui <- function(id) {
list(
outlier_input = list(
sliderInput(ns("remove_outlier_percentage"),
"Remove top x% from view",
min = 0, max = 100, value = 0, round = TRUE
"Remove top x% from view",
min = 0, max = 100, value = 0, round = TRUE
)
),
p_val_input = list(
numericInput(ns("user_p_val"), "\U003B1",
min = 0, max = 1, value = 0.05, step = 0.01
min = 0, max = 1, value = 0.05, step = 0.01
)
),
power_val_input = list(
numericInput(ns("power_value"), "Power (1-\U03B2)",
min = 0, max = 1, value = 0.80, step = 0.01
min = 0, max = 1, value = 0.80, step = 0.01
)
),
ci_inputs = list(
Expand All @@ -42,36 +42,39 @@ mod_plot_distributions_ui <- function(id) {
)
),
output_plots = list(
power_plot = shinycssloaders::withSpinner(
plotOutput(ns("power_plot"), height = "800px"),
type = 2, color.background = "#0275D8"
),
p_val_plot = shinycssloaders::withSpinner(
plotOutput(ns("distribution_plot_results"), height = "800px"),
type = 2, color.background = "#0275D8"
)
),
power_plot = shinycssloaders::withSpinner(
plotOutput(ns("power_plot"), height = "800px"),
type = 2, color.background = "#0275D8"
),
p_val_plot = shinycssloaders::withSpinner(
plotOutput(ns("distribution_plot_results"), height = "800px"),
type = 2, color.background = "#0275D8"
)
),
output_data = list(
nav_panel(
title = "Power and Type II Error",
shinycssloaders::withSpinner(
DT::dataTableOutput(ns("distribution_statistics")),
type = 8)
),
type = 8
)
),
nav_panel(
title = "Typer I Error: Group 1",
shinycssloaders::withSpinner(
DT::dataTableOutput(ns("t1_error_group1")),
type = 8)
),
type = 8
)
),
nav_panel(
title = "Typer I Error: Group 2",
shinycssloaders::withSpinner(
DT::dataTableOutput(ns("t1_error_group2")),
type = 8)
type = 8
)
)
)
)
}

#' plot_distributions Server Functions
Expand Down Expand Up @@ -101,7 +104,8 @@ mod_plot_distributions_server <- function(id, p_value_table, n) {
"Wilcoxon", "Fisher", "Chi Squared\n(No Correction)",
"Chi Squared\n(Correction)", "Prop. Odds", "Coin Indep. Test"
)),
.data$sample_size) %>%
.data$sample_size
) %>%
plot_distribution_results(
outlier_removal = outlier_percent_removal(),
alpha = p_val_threshold()
Expand All @@ -121,7 +125,8 @@ mod_plot_distributions_server <- function(id, p_value_table, n) {
"Wilcoxon", "Fisher", "Chi Squared\n(No Correction)",
"Chi Squared\n(Correction)", "Prop. Odds", "Coin Indep. Test"
)),
.data$sample_size) %>%
.data$sample_size
) %>%
calculate_power_t2error(
alpha = p_val_threshold(),
n = n(),
Expand Down Expand Up @@ -165,12 +170,13 @@ mod_plot_distributions_server <- function(id, p_value_table, n) {
"Wilcoxon", "Fisher", "Chi Squared\n(No Correction)",
"Chi Squared\n(Correction)", "Prop. Odds", "Coin Indep. Test"
)),
.data$sample_size) %>%
.data$sample_size
) %>%
group_by(.data$sample_size) %>%
calculate_t1_error(
alpha = p_val_threshold(),
t1_error_confidence_int = input$t1_error_group1_confidence_int
)
)
})
output$t1_error_group1 <- DT::renderDataTable({
# browser()
Expand All @@ -195,12 +201,13 @@ mod_plot_distributions_server <- function(id, p_value_table, n) {
"Wilcoxon", "Fisher", "Chi Squared\n(No Correction)",
"Chi Squared\n(Correction)", "Prop. Odds", "Coin Indep. Test"
)),
.data$sample_size) %>%
.data$sample_size
) %>%
group_by(.data$sample_size) %>%
calculate_t1_error(
alpha = p_val_threshold(),
t1_error_confidence_int = input$t1_error_group2_confidence_int
)
)
})
output$t1_error_group2 <- DT::renderDataTable({
group2_t1_reactive_table() %>%
Expand Down
1 change: 0 additions & 1 deletion R/mod_rng_option.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ mod_rng_option_ui <- function(id) {
selected = "Rejection"
)
)

}

#' rng_option Server Functions
Expand Down
7 changes: 3 additions & 4 deletions R/mod_row_add.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#' @noRd
#'
#' @importFrom shiny NS tagList
mod_row_add_ui <- function(id){
mod_row_add_ui <- function(id) {
ns <- NS(id)
tagList(
actionButton(ns("add_row"), "Add Row")
Expand All @@ -17,16 +17,15 @@ mod_row_add_ui <- function(id){
#' row_add Server Functions
#'
#' @noRd
mod_row_add_server <- function(id){
moduleServer( id, function(input, output, session){
mod_row_add_server <- function(id) {
moduleServer(id, function(input, output, session) {
ns <- session$ns

add_row_button <- reactive({
input$add_row
})

return(add_row_button)

})
}

Expand Down
Loading

0 comments on commit 6d4d585

Please sign in to comment.