{"id":19132348,"url":"https://github.com/jbryer/visualstats","last_synced_at":"2025-05-06T16:28:22.637Z","repository":{"id":142119793,"uuid":"451904715","full_name":"jbryer/VisualStats","owner":"jbryer","description":"R package for visualizing statistical tests","archived":false,"fork":false,"pushed_at":"2024-11-06T15:01:52.000Z","size":242233,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-06T15:49:34.766Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://visualstats.bryer.org","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jbryer.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-25T14:14:45.000Z","updated_at":"2024-11-06T14:58:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"0f74075b-fdc0-432b-9ff6-07b2a38bd531","html_url":"https://github.com/jbryer/VisualStats","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbryer%2FVisualStats","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbryer%2FVisualStats/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbryer%2FVisualStats/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbryer%2FVisualStats/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jbryer","download_url":"https://codeload.github.com/jbryer/VisualStats/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223791267,"owners_count":17203443,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T06:17:53.436Z","updated_at":"2025-04-19T07:32:02.410Z","avatar_url":"https://github.com/jbryer.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\ntitle: \"VisualStats: R package for visualizing statistical tests\"\noutput:\n  github_document:\n    html_preview: false\neditor_options:\n  chunk_output_type: console\n---\n\n```{r, echo = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\"\n)\n```\n\n\u003cimg src=\"man/figures/VisualStats.png\" align=\"right\" width=\"120\" /\u003e\n\n**Authors: Jason Bryer, Ph.D. and Bruce Dudek, Ph.D.**    \n**Website: https://visualstats.bryer.org/**\n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/jbryer/VisualStats/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/jbryer/VisualStats/actions/workflows/R-CMD-check.yaml)\n[![Book Status](https://github.com/jbryer/VisualStats/actions/workflows/build-site.yaml/badge.svg)](https://github.com/jbryer/VisualStats/actions/workflows/bookdown.yaml)\n[![WebR Repo](https://github.com/jbryer/VisualStats/actions/workflows/deploy-cran-repo.yaml/badge.svg)](https://github.com/jbryer/VisualStats/actions/workflows/R-CMD-check.yaml)\n`r badger::badge_devel(\"jbryer/VisualStats\", \"blue\")`\n`r badger::badge_cran_release(\"VisualStats\")`\n\u003c!-- badges: end --\u003e\n\nThis package contains functions and [Shiny](https://shiny.rstudio.com) applications designed to visualize statistical tests. The repository also contains a [Quarto book](https://jbryer.github.io/VisualStats). The latest version can be installed from Github using the `remotes` package:\n\n```{r, eval=FALSE}\nremotes::install_github('jbryer/VisualStats')\n```\n\n\n\n### Framework for creating Shiny applications\n\nOne of the primary goals of using the Quarto book website format is that Shiny applications can be embedded providing the reader the ability to interact with many of the statistical visualizations presented. The [WebR](https://docs.r-wasm.org/webr/latest/) project provides the framework for embedding R code within HTML pages. Ideally we would load the `VisualStats` package in WebR and call the functions directly. Unfortunatley, the WebR framework does not support installing R packages from source (and according to their documentation, [may likely never have this feature](https://docs.r-wasm.org/webr/latest/building.html#:~:text=It%20is%20not%20possible%20to,to%20install%20packages%20in%20webR.)). However, it is possible to load R scripts from source. The goal here is to maximize the ways in which Shiny applications can be deployed (using Shiny server, running locally, and embedded in Quarto documents) while minimizing the code duplication.\n\nWhen developing a new Shiny application, the app should be located in the [`R/`](R/) directory as R package functions (i.e. include [Roxygen documentation](https://roxygen2.r-lib.org)). In particular there needs to be at least three functions (note that `FEATURE` should be replaced with the name of the application):\n\n```\n#' Shiny UI\n#' @return a Shiny UI object.\n#' @export\nFEATURE_shiny_ui \u003c- function() {\n  # Shiny UI code here. Basic siderbar panel provided\n  fluidPage(\n\t\tsidebarLayout(\n\t\t\tsidebarPanel(\n\t\t\t  # Shiny inputs\n\t\t\t),\n\t\t\tmainPanel(plotOutput(\"plot\", height = '600px'))\n\t\t)\n\t)\n}\n\n#' Shiny server\n#' @param input Shiny input object.\n#' @param output Shiny output object.\n#' @param session Shiny session object.\n#' @return a function with Shiny server logic.\n#' @export\nFEATURE_shiny_server \u003c- function(input, output, session) {\n  # Shiny server code here\n  output$plot \u003c- renderPlot({\n    # Plotting code\n})\n}\n\n#' Run the Shiny server\n#' @param ... other parameters passed to [shiny::shinyApp]\n#' @export\nFEATURE_shiny \u003c- function(...) {\n\tshiny::shinyApp(ui = FEATURE_shiny_ui, server = FEATURE_shiny_server, ...)\n}\n```\n\n**Note: Using shinylive to embed Shiny applications currently does not work consistently. For now Shiny applications are hosted using Shiny server and are embedded using HTML iframes.**\n\nWithin the Quarto document where the Shiny application is to be embedded, add the following code in a `shinylive-r` code chunk. Note that we need to source the R scripts containing the relevant functions. Since we are calling these functions outside of the `VisualStats` R package any package dependencies need to be installed using teh `webr::install` command and loaded using the `library` command.\n\n````yml\n```{shinylive-r}\n#| label: fig-shiny-FEATURE\n#| viewerHeight: 600\n#| standalone: true\nwebr::install(\"ggplot2\")\nlibrary(ggplot2)\n# Include any R scripts that have the implementation of any R functions used\nsource('https://raw.githubusercontent.com/jbryer/VisualStats/main/R/FEATURE_vis.R')\n# Include R script defining the Shiny UI and server\nsource('https://raw.githubusercontent.com/jbryer/VisualStats/main/R/FEATURE_shiny.R')\nshinyApp(ui = FEATURE_shiny_ui, server = FEATURE_shiny_server)\n```\n````\n\nTo deploy the application using Shiny server, create a file called `app.R` with the following (these are also included in the `inst/shiny` directory):\n\n```\nlibrary(VisualStats)\nshinyApp(ui = FEATURE_shiny_ui, server = FEATURE_shiny_server)\n```\n\n### Helpful links\n\n* [Quarto book options](https://quarto.org/docs/reference/projects/books.html#sidebar)\n* [Search for R packages available as WebR packages](https://rud.is/w/webr-pkgs/)\n* [Figure options for Quarto](https://quarto.org/docs/authoring/figures.html)\n* [Code blocks options](https://quarto.org/docs/output-formats/html-code.html)\n\n\n## Code of Conduct\n  \n Please note that the VisualStats project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/1/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbryer%2Fvisualstats","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjbryer%2Fvisualstats","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbryer%2Fvisualstats/lists"}