Skip to content
Open
Changes from all commits
Commits
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
36 changes: 28 additions & 8 deletions R/exportNetworkToHTML.R
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@
#' Export network data with Cytoscape visualization
```r
#' Export Network Data to HTML with Cytoscape Visualization
#'
#' Convenience function that takes nodes and edges data directly and creates
#' both the configuration and HTML export in one step.
#' @description
#' This function exports network data to an HTML file with a Cytoscape
#' visualization. It takes nodes and edges data directly and creates both the
#' configuration and HTML export in one step, providing a convenient way to
#' visualize network data.
#'
#' @param nodes \code{data.frame} containing the nodes of the network. Each row
#' represents a node with at least an \code{id} column.
#' @param edges \code{data.frame} containing the edges of the network. Each row
#' represents an edge with at least \code{source} and \code{target} columns.
#' @param filename \code{character} string specifying the output HTML filename.
#' Defaults to \code{"network_visualization.html"}.
#' @param displayLabelType \code{character} string indicating the type of label
#' to display on nodes. Defaults to \code{"id"}.
#' @param nodeFontSize \code{numeric} value specifying the font size of node
#' labels. Defaults to \code{12}.
#' @param ... Additional arguments passed to \code{exportCytoscapeToHTML()}.
#'
#' @return Invisibly returns the file path of the created HTML file.
#'
#' @examples
#' nodes <- data.frame(id = c("A", "B", "C"))
#' edges <- data.frame(source = c("A", "B"), target = c("B", "C"))
#' exportNetworkToHTML(nodes, edges, filename = "my_network.html")
#'
#' @inheritParams cytoscapeNetwork
#' @param filename Output HTML filename
#' @param ... Additional arguments passed to exportCytoscapeToHTML()
#' @export
#' @return Invisibly returns the file path of the created HTML file
exportNetworkToHTML <- function(nodes, edges,
filename = "network_visualization.html",
displayLabelType = "id",
Expand Down Expand Up @@ -65,4 +84,5 @@ previewNetworkInBrowser <- function(nodes, edges,
}

invisible(temp_file)
}
}
```