Skip to content

Commit 89be6a0

Browse files
author
markomi
committed
refactoring and documentation
1 parent e91f9d2 commit 89be6a0

32 files changed

+118
-99
lines changed

R/app.R

Lines changed: 0 additions & 12 deletions
This file was deleted.

R/app_server.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ app_server <- function(input, output) {
1212
calc_prop <- readRDS(system.file("extdata", "calc_prop_test.rds", package = "shinysse"))
1313
# get module labels and then call
1414
mod <- get_module_registry()
15-
callModule(app_intro, mod$app_intro)
15+
callModule(sse_intro, mod$sse_intro)
1616
callModule(sse_ttest, mod$sse_ttest, calc_t_twosample, calc_t_paired)
1717
callModule(sse_ttest_plus, mod$sse_ttest_plus, calc_t_twosample, calc_t_paired)
1818
callModule(sse_prop, mod$sse_prop, calc_prop)

R/app_ui.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ app_ui <- function(){
1212
dashboardSidebar(
1313
div(p(" ")),
1414
sidebarMenu(
15-
menuItem("Introduction", tabName = mod$app_intro, icon = icon("info")),
15+
menuItem("Introduction", tabName = mod$sse_intro, icon = icon("info")),
1616
menuItem("Two sample t-Test SSE", tabName = mod$sse_ttest, icon = icon("text-size", lib = "glyphicon")),
1717
menuItem("Two sample t-Test SSE + input", tabName = mod$sse_ttest_plus, icon = icon("text-size", lib = "glyphicon")),
1818
menuItem("Proportion Test SSE", tabName = mod$sse_prop, icon = icon("percentage"))
@@ -23,7 +23,7 @@ app_ui <- function(){
2323
tags$link(rel = "stylesheet", type = "text/css", href = "www/custom.css")
2424
),
2525
tabItems(
26-
app_intro_ui(mod$app_intro, label = mod$app_intro),
26+
sse_intro_ui(mod$sse_intro, label = mod$sse_intro),
2727
sse_ttest_ui(mod$sse_ttest, label = mod$sse_ttest),
2828
sse_ttest_plus_ui(mod$sse_ttest_plus, label = mod$sse_ttest_plus),
2929
sse_prop_ui(mod$sse_prop, label = mod$sse_prop)

R/fun_calc_prop.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#' Evaluates power functions for power.prop.test
22
#'
33
#' For all pre-set combinations of n, theta, xi and alpha, this function calculates a list of powCalc
4-
#' objects and saves.
4+
#' objects and saves the list.
55
#'
66
#' Input parameters are optional. Defaults:
77
#' * n <- seq(from = 3, to = 10000, by = 5)
@@ -14,8 +14,9 @@
1414
#' @param theta numeric vector containing possible range of effect sizes
1515
#' @param xi numeric vector containing possible range of proportions
1616
#' @param alpha numeric vector containing possible range of significance levels
17-
#' @param save_path string inidicating where the function output should be saved
17+
#' @param save_path string inidicating where the function output should be saved
1818
#' @return list of calculated powCalc objects
19+
#' @seealso \code{\link{calc_t}}
1920
#' @export
2021
#'
2122
calc_prop <- function(n, theta, xi, alpha, save_path){

R/fun_calc_t.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#' Evaluates power functions for power.t.test
22
#'
33
#' For all pre-set combinations of n, theta, xi and alpha, this function calculates a list of powCalc
4-
#' objects and saves them.
4+
#' objects and saves the list.
55
#'
66
#' Input parameters are optional. Defaults:
77
#' * n <- seq(from = 5, to = 2000, by = 5)
@@ -17,6 +17,7 @@
1717
#' @param type string of value "two.sample", "one.sample", or "paired"
1818
#' @param save_path string inidicating where the function output should be saved
1919
#' @return list of calculated powCalc objects
20+
#' @seealso \code{\link{calc_prop}}
2021
#' @export
2122
#'
2223
calc_t <- function(n, theta, xi, alpha, type, save_path){

R/fun_get_header_mint.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#' Shinydashboard two-color custom mint header
22
#'
33
#' @param header_title string containing a header title
4-
#' @return shiny.tag list with a custom header with title as defined in header_title
4+
#' @return shiny.tag list with a custom header
55
#' @export
66
#'
77
get_header_mint <- function(header_title){

R/fun_get_module_registry.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
#' Retrieves a list of module names
1+
#' Retrieves a list of module aliases
22
#'
3-
#' These names will be used to define module IDs in shiny::callModule(),
4-
#' and also as tabnames for the sidebar, and shiny UI function label and id.
3+
#' Module aliases retrieved via get_module_registry() are used to define module IDs in shiny::callModule(),
4+
#' and are also used as tabnames for the sidebar, and shiny UI function, label and id.
55
#'
6-
#' @return list of strings containing names of
6+
#' @return list of strings containing module aliases
77
#' @seealso \code{\link{app_ui}}, \code{\link{app_server}}
88
#' @export
99
#'
1010
get_module_registry <- function(){
1111
mod <- list()
12-
mod$app_intro <- "app_intro"
12+
mod$sse_intro <- "sse_intro"
1313
mod$sse_ttest <- "sse_ttest"
1414
mod$sse_ttest_plus <- "sse_ttest_plus"
1515
mod$sse_prop <- "sse_prop"

R/fun_run_shiny.R

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#' Launches the shinysse Shiny web app
2+
#'
3+
#' You can run the web application by calling the run_shiny() function.
4+
#'
5+
#' @seealso \code{\link{app_server}}, \code{\link{app_ui}}
6+
#' @export
7+
#'
8+
run_shiny <- function(){
9+
## make resources available globally from non standard location
10+
addResourcePath("www", system.file("www", package = "shinysse"))
11+
shiny_app <- shinyApp(ui = app_ui, server = app_server)
12+
}

R/mod_app_intro_server.R

Lines changed: 0 additions & 7 deletions
This file was deleted.

R/mod_sse_intro_server.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#' Shiny module server function for the app introduction page
2+
#'
3+
#' @seealso \code{\link{sse_intro_ui}}
4+
#'
5+
sse_intro <- function(input, output, session) {
6+
7+
}

0 commit comments

Comments
 (0)