Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #67

Merged
merged 27 commits into from
Feb 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
80774e1
Change triggers for running R CMD checks
NeuroShepherd Feb 13, 2024
208ef5d
Don't autorun on push to development
NeuroShepherd Feb 13, 2024
5ea0af5
Set up ShinyApps io deployment action (#60)
NeuroShepherd Feb 13, 2024
7c3991d
Install libgit2-dev in action workflow
NeuroShepherd Feb 13, 2024
289f997
Fix typo in action
NeuroShepherd Feb 13, 2024
b447b48
Add account name attempt
NeuroShepherd Feb 13, 2024
c34a568
Update renv dependencies for action
NeuroShepherd Feb 13, 2024
6b59c9b
Remove browser call
NeuroShepherd Feb 13, 2024
38e2dda
Force updates to Shiny site
NeuroShepherd Feb 13, 2024
ffef272
Use golem fix for deploying to shinyapps.io
NeuroShepherd Feb 13, 2024
0540ce7
Merge branch 'master' into development
NeuroShepherd Feb 13, 2024
2836bb6
Add spinners to loadable components
NeuroShepherd Feb 13, 2024
90cdd9a
Ensure evaluation of T1 error, T2 error/power calcs
NeuroShepherd Feb 14, 2024
d7c7690
Remove commented-out code
NeuroShepherd Feb 14, 2024
81159ce
Include CI for Type II error
NeuroShepherd Feb 15, 2024
8fcf044
Create functional add/delete buttons (#65)
NeuroShepherd Feb 15, 2024
881f5de
Add CRAN status badge
NeuroShepherd Feb 15, 2024
5de4c1a
Vignettes (#55)
NeuroShepherd Feb 16, 2024
7c6a391
Write more descriptive vignette and add app options
NeuroShepherd Feb 16, 2024
f18c7a9
Finish vignette draft
NeuroShepherd Feb 16, 2024
acdb71d
Update renv lockfile
NeuroShepherd Feb 17, 2024
df2aadc
Remove pkgload from project Imports
NeuroShepherd Feb 17, 2024
601f331
Expand vignette examples
NeuroShepherd Feb 17, 2024
a572c13
Update README with more useful information
NeuroShepherd Feb 17, 2024
ecb3501
Create {pkgdown} formatted website
NeuroShepherd Feb 17, 2024
34ad8eb
Merge branch 'master' into development
NeuroShepherd Feb 17, 2024
133035a
Rebuild website only on main push or workflow dispatch
NeuroShepherd Feb 17, 2024
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
6 changes: 6 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ $run_dev.*
^\.github$
^app\.R$
^rsconnect$
^doc$
^Meta$
^_pkgdown\.yml$
^docs$
^pkgdown$

48 changes: 48 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
# pull_request:
# branches: [main, master]
release:
types: [published]
workflow_dispatch:

name: pkgdown

jobs:
pkgdown:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
needs: website

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/[email protected]
with:
clean: false
branch: gh-pages
folder: docs
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
.Rhistory
.RData
.Ruserdata
inst/doc
/doc/
/Meta/
docs
5 changes: 4 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@ Imports:
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.2.3
URL: https://github.com/NeuroShepherd/ordinalsimr
URL: https://github.com/NeuroShepherd/ordinalsimr, https://neuroshepherd.github.io/ordinalsimr/
BugReports: https://github.com/NeuroShepherd/ordinalsimr/issues
Suggests:
knitr,
rmarkdown,
testthat (>= 3.0.0)
Config/testthat/edition: 3
Depends:
R (>= 2.10)
VignetteBuilder: knitr
15 changes: 12 additions & 3 deletions R/mod_data_entry.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,20 @@ mod_data_entry_server <- function(id){
ns <- session$ns

default_entry_rows <- getOption("ordinalsimr.default_entry_rows", default = 3)
entered_data = data.frame(`Group 1 Probabilities` = rep(0, default_entry_rows),
`Group 2 Probabilities` = rep(0, default_entry_rows),
check.names = FALSE)
default_dist_option <- getOption("ordinalsimr.default_distributions")
default_distribution_data <- data.frame(`Group 1 Probabilities` = rep(0, default_entry_rows),
`Group 2 Probabilities` = rep(0, default_entry_rows),
check.names = FALSE)
entered_data <- if (is.data.frame(default_dist_option)) {
default_dist_option %>%
dplyr::rename(`Group 1 Probabilities` = 1,
`Group 2 Probabilities` = 2)
} else {
default_distribution_data
}
reactive_data_vals <- reactiveVal(entered_data)


observeEvent(input$hottable, { reactive_data_vals(hot_to_r(input$hottable)) } )
observeEvent(input$add_row, { reactive_data_vals(rbind(reactive_data_vals(), 0)) })
observeEvent(input$delete_row, { reactive_data_vals(reactive_data_vals()[-nrow(reactive_data_vals()), ]) })
Expand Down
4 changes: 2 additions & 2 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ parse_ratio_text <- function(text) {

#' Calculate Hypothesis Test Parameters
#'
#' This function calculates the power, Type II error, and Type I error of tests given p-values. Power, Type II error, and confidence intervals calculated using `stats::binom.test()`.
#' This function calculates the power, Type II error, and Type I error of tests given p-values. Power, Type II error, and confidence intervals calculated using `stats::binom.test()` which implements the Newcombe method.
#'
#' @param df Data frame where each column is a vector of p-values from a statistical test
#' @param alpha Numeric significance level; defaults to 0.05
Expand Down Expand Up @@ -78,7 +78,7 @@ calculate_power_t2error <- function(df, alpha = 0.05, power_confidence_int = 95,

#' Calculate Type 1 Error
#'
#' Calculate Type 1 error for a distribution, and the confidence interval around this estimate. Type I error and confidence intervals calculated using `stats::binom.test()`.
#' Calculate Type 1 error for a distribution, and the confidence interval around this estimate. Type I error and confidence intervals calculated using `stats::binom.test()` which implements the Newcombe method.
#'
#' @param df data frame
#' @param alpha significance level
Expand Down
10 changes: 9 additions & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ knitr::opts_chunk$set(
[![CRAN status](https://www.r-pkg.org/badges/version/ordinalsimr)](https://CRAN.R-project.org/package=ordinalsimr)
<!-- badges: end -->

The goal of ordinalsimr is to ...
The {ordinalsimr} package assists in constructing simulation studies of ordinal data comparing two groups. It is intended to facilitate translation of methodological advances into practical settings for e.g. applied statisticians and data analysts who want to determine an appropriate statistical test to apply on their data or a proposed distribution of data.

This package is primarily developed as a Shiny application which abstracts away the heavier coding aspect of setting up simulation studies. Instead, users can simply enter parameters and data distributions into the application, and save the results as an `.rds` file. The structure of the Shiny application only allows for one simulation to be specified at a time as opposed to a grid of parameters. However, the underlying functions for running the simulations are accessible. See `vignette("ordinalsimr")` for template code on setting up your own simulations manually.

## Installation

Expand All @@ -32,6 +34,12 @@ You can install the development version of ordinalsimr from [GitHub](https://git
devtools::install_github("NeuroShepherd/ordinalsimr")
```

## Recommendations

The application is available at [link], but may be down due to account usage limitations on ShinyApps.io. There is not currently a plan to increase the usage limits so it is *strongly recommended that you run the application locally*.

Informative progressive bars have not been implemented in the Shiny application, but a simulation that fails to run will almost always fail at the beginning rather than in the middle of the run. Simulations with 1000s of iterations *will* take minutes to hours to run.




29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,22 @@ experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](h
status](https://www.r-pkg.org/badges/version/ordinalsimr)](https://CRAN.R-project.org/package=ordinalsimr)
<!-- badges: end -->

The goal of ordinalsimr is to …
The {ordinalsimr} package assists in constructing simulation studies of
ordinal data comparing two groups. It is intended to facilitate
translation of methodological advances into practical settings for
e.g. applied statisticians and data analysts who want to determine an
appropriate statistical test to apply on their data or a proposed
distribution of data.

This package is primarily developed as a Shiny application which
abstracts away the heavier coding aspect of setting up simulation
studies. Instead, users can simply enter parameters and data
distributions into the application, and save the results as an `.rds`
file. The structure of the Shiny application only allows for one
simulation to be specified at a time as opposed to a grid of parameters.
However, the underlying functions for running the simulations are
accessible. See `vignette("ordinalsimr")` for template code on setting
up your own simulations manually.

## Installation

Expand All @@ -23,3 +38,15 @@ You can install the development version of ordinalsimr from
# install.packages("devtools")
devtools::install_github("NeuroShepherd/ordinalsimr")
```

## Recommendations

The application is available at \[link\], but may be down due to account
usage limitations on ShinyApps.io. There is not currently a plan to
increase the usage limits so it is *strongly recommended that you run
the application locally*.

Informative progressive bars have not been implemented in the Shiny
application, but a simulation that fails to run will almost always fail
at the beginning rather than in the middle of the run. Simulations with
1000s of iterations *will* take minutes to hours to run.
4 changes: 4 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
url: https://neuroshepherd.github.io/ordinalsimr/
template:
bootstrap: 5

2 changes: 1 addition & 1 deletion man/calculate_power_t2error.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/calculate_t1_error.Rd

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

1 change: 1 addition & 0 deletions man/ordinalsimr-package.Rd

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

14 changes: 14 additions & 0 deletions renv.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1887,6 +1887,20 @@
],
"Hash": "3a1f41807d648a908e3c7f0334bf85e6"
},
"shinycssloaders": {
"Package": "shinycssloaders",
"Version": "1.0.0",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R",
"digest",
"glue",
"grDevices",
"shiny"
],
"Hash": "f39bb3c44a9b496723ec7e86f9a771d8"
},
"shinydashboard": {
"Package": "shinydashboard",
"Version": "0.7.2",
Expand Down
2 changes: 2 additions & 0 deletions vignettes/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.html
*.R
Binary file not shown.
Loading