Skip to content

AlfCano/rk.network.graphs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rk.network.graphs: Network Graph Generation and Export for RKWard

Version License RKWard R Linter

rk.network.graphs brings powerful network analysis and visualization to the RKWard GUI. Built on top of the robust igraph, IRanges, and rgexf packages, this plugin suite bridges the gap between qualitative coding software (like QualCoder), raw adjacency matrices, and professional network visualization tools (like Gephi).

Create, highlight, and batch-export complex networks in high definition without writing any R code.

🚀 What's New in Version 0.0.1

This is the initial release of the package, introducing three core components designed for network creation and aesthetic customization:

  1. Ranges to Network: Specifically designed for Qualitative Data Analysis (e.g., QualCoder). It takes coded text segments (start/end indices) and automatically finds overlaps to build a code co-occurrence network.
  2. Matrix to Network: Converts standard adjacency or co-occurrence data frames (e.g., imported from Excel or CSV) into fully weighted and directed/undirected igraph objects.
  3. Export Networks: A powerful batch-processing tool that takes an igraph object (or a List of them) and instantly exports them to .gexf (for Gephi) or high-res images (PNG, PDF, SVG).

🌍 Internationalization

The interface is fully localized in:

  • 🇺🇸 English (Default)
  • 🇪🇸 Spanish (es)
  • 🇫🇷 French (fr)
  • 🇩🇪 German (de)
  • 🇧🇷 Portuguese (Brazil) (pt_BR)

✨ Features

1. "Storytelling with Data" (SWD) Aesthetics

  • Smart Highlighting: Stop presenting chaotic, multi-colored "hairball" networks. Apply a muted base color (like SWD Light Gray) to your entire graph, and automatically highlight key nodes and their text labels in bold SWD Orange, Blue, or Red by simply typing their names.
  • Algorithmic Layouts: Choose from 9 different distribution algorithms (Fruchterman-Reingold, Kamada-Kawai, Circle, Star, MDS, etc.) directly from a dropdown menu.

2. Flexible Matrix Handling

  • Easily process generic Excel matrices. Tell the plugin if your first column contains the node names, whether to include diagonals (self-loops), and whether the graph is weighted or directed. Node sizes and edge widths are automatically scaled based on connection strength.

3. Batch Export & Integration

  • Gephi Ready: Automatically export your networks to the .gexf format to perform advanced modularity and community detection in Gephi.
  • Publication-Ready Images: Export directly to vector (.pdf, .svg) or raster (.png) formats with full control over dimensions (pixels) and resolution (DPI).

📦 Installation

This plugin is not yet on CRAN. To install it, use the remotes or devtools package in RKWard.

Important: This plugin requires IRanges, a Bioconductor package.

  1. Open RKWard.

  2. Run the following commands in the R Console:

    # Install IRanges from Bioconductor
    if (!require("BiocManager", quietly = TRUE)) install.packages("BiocManager")
    BiocManager::install("IRanges")
    
    # Install the plugin
    local({
      require(devtools)
      install_github("AlfCano/rk.network.graphs", force = TRUE)
    })
  3. Restart RKWard to load the new menu entries.

💻 Usage & Testing Instructions

Once installed, the tools are located under the graphics menu: Plots -> Network Graphs

You can test the Matrix to Network and Export features immediately by generating a dummy co-occurrence matrix in RKWard. Copy and paste this into your console:

# Create a dummy co-occurrence matrix
mat <- matrix(c(0, 5, 2, 1, 
                5, 0, 8, 0, 
                2, 8, 0, 3,
                1, 0, 3, 0), nrow=4)
colnames(mat) <- rownames(mat) <- c("Policy", "Economy", "Health", "Education")

# Convert to dataframe for the plugin
dummy_matrix <- as.data.frame(mat)
dummy_matrix <- cbind(Node = rownames(dummy_matrix), dummy_matrix)
rownames(dummy_matrix) <- NULL

Test 1: Create and Highlight the Network

  1. Go to Plots -> Network Graphs -> Matrix to Network.
  2. Input & Options tab: Select dummy_matrix. Ensure "First column contains Node Names" and "Weighted Graph" are checked.
  3. Aesthetics tab:
    • Change Plot Layout to Kamada-Kawai.
    • In Nodes to Highlight, type: Economy
    • Set Base Color to SWD Light Gray and Highlight Color to SWD Orange.
  4. Graphics Device tab: Click Preview. Notice how "Economy" pops out beautifully against the gray network!
  5. Click Submit to save net_graph_adj to your workspace.

Test 2: Exporting to Gephi and PNG

  1. Go to Plots -> Network Graphs -> Export Networks.
  2. Select net_graph_adj as your Target object.
  3. Choose an output directory (e.g., your Desktop) and name it my_network.
  4. Ensure both Export as GEXF and Export as Image (PNG) are checked.
  5. Click Submit. You now have a publication-ready image and a Gephi-ready data file saved on your computer!

🛠️ Dependencies

This plugin relies on the following R packages:

  • igraph (Core network generation and plotting)
  • IRanges (Overlap calculation for text coding)
  • rgexf (Gephi export capabilities)
  • rkwarddev (Plugin generation)

✍️ Author & License

About

Brings powerful network analysis and visualization to the RKWard GUI. Built on top of the robust `igraph`, `IRanges`, and `rgexf` packages, this plugin suite bridges the gap between qualitative coding software (like QualCoder), raw adjacency matrices, and professional network visualization tools (like Gephi).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors