#' Create a network graph of invariance matrices
#'
#' \code{NetworkGraph} creates a network graph for each invaraince matrix in a
#' list.
#'
#' This function uses \code{\link[qgraph]{qgraph}} to create a network graph of
#' each invariance matrix in a list.
#'
#' @param matrix.list A list of invariance matrices from
#' \code{\link{InvarianceMatrices}}
#' @param ... optional arguments that are passed to \code{\link[qgraph]{qgraph}}
#' @return This function plots a network graph for each invaraince matrix
#'
#' @export
NetworkGraph <- function(matrix.list, ...) {
# creating list to fill in and output
out.list <- list()
# for each invariance matrix, create network graph
for(matrix.number in 1:length(matrix.list)){
# subset matrix.list to a matrix
temp.matrix <- matrix.list[[matrix.number]]
# clean up matrix
temp.matrix <- temp.matrix - min(temp.matrix, na.rm = T)
temp.matrix <- 1-(temp.matrix/max(temp.matrix, na.rm = T))
# create network
temp.network = qgraph::qgraph(temp.matrix, ...)
# fill in output list
out.list[[matrix.number]] <- temp.network
# create names for output list
names(out.list)[matrix.number] <- names(matrix.list)[matrix.number]
}
return(out.list)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.