Skip to content

Commit

Permalink
first pass documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
d-callan committed Nov 22, 2023
1 parent d3cbdaf commit 3f207cd
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 1 deletion.
5 changes: 5 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Generated by roxygen2: do not edit by hand

export(bipartiteNetwork)
export(bipartiteNetworkOutput)
export(renderBipartiteNetwork)
import(dplyr)
import(ggplot2)
import(htmlwidgets)
Expand All @@ -8,6 +11,8 @@ importFrom(DT,DTOutput)
importFrom(DT,renderDT)
importFrom(bslib,bs_theme)
importFrom(r2d3,html_dependencies_d3)
importFrom(shiny,export)
importFrom(shiny,shinyApp)
importFrom(shinyjs,useShinyjs)
importFrom(stats,rnorm)
importFrom(utils,read.table)
8 changes: 7 additions & 1 deletion R/app.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#' corGraph Shiny App
#'
#' Launches the corGraph Shiny App
#'
#' @importFrom shiny shinyApp
#' export
corGraph <- function(...) {
shinyApp(ui, server, ...)
shiny::shinyApp(ui, server, ...)
}
25 changes: 25 additions & 0 deletions R/bipartiteNetworkWidget.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,18 @@ library(htmlwidgets)
library(dplyr)
library(r2d3)

#' bipartiteNetwork
#'
#' Create a bipartiteNetwork widget
#'
#' @param data a data frame with source, target, and value columns
#' @param width the width of the widget
#' @param height the height of the widget
#' @param elementId the ID of the widget
#' @import htmlwidgets
#' @importFrom r2d3 html_dependencies_d3
#' @import dplyr
#' @export
bipartiteNetwork <- function(data, width = NULL, height = NULL, elementId = NULL) {
if (!inherits(data, "data.frame") || !all(c("source", "target", "value") %in% names(data))) {
stop("Data must be a data frame with source, target, and value columns.")
Expand All @@ -26,10 +35,26 @@ bipartiteNetwork <- function(data, width = NULL, height = NULL, elementId = NULL
)
}

#' Shiny bindings for bipartiteNetwork
#'
#' Output function for using bipartiteNetwork within Shiny apps
#'
#' @param outputId output variable to read from
#' @param width,height Must be a valid CSS unit (like \code{'100\%'}, '400px', or 'auto')
#' @export
bipartiteNetworkOutput <- function(outputId, width = '100%', height = '400px'){
htmlwidgets::shinyWidgetOutput(outputId, 'bipartitenetwork', width, height, package = 'correlationMatrixAsNetwork')
}

#' Shiny bindings for bipartiteNetwork
#'
#' Render function for using bipartiteNetwork within Shiny apps
#'
#' @param expr an expression that generates bipartiteNetwork
#' @param env the environment in which to evaluate \code{expr}
#' @param quoted Is \code{expr} a quoted expression (with \code{quote()})? This
#' is useful if you want to save an expression in a variable
#' @export
renderBipartiteNetwork <- function(expr, env = parent.frame(), quoted = FALSE) {
if (!quoted) { expr <- substitute(expr) }
htmlwidgets::shinyRenderWidget(expr, bipartiteNetworkOutput, env, quoted = TRUE)
Expand Down
20 changes: 20 additions & 0 deletions man/bipartiteNetwork.Rd

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

16 changes: 16 additions & 0 deletions man/bipartiteNetworkOutput.Rd

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

11 changes: 11 additions & 0 deletions man/corGraph.Rd

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

19 changes: 19 additions & 0 deletions man/renderBipartiteNetwork.Rd

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

0 comments on commit 3f207cd

Please sign in to comment.