Skip to content
Back to skills

Sna

ASecurity

R sna package for social network analysis. Use for network statistics and visualization with statnet.

  • 5 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added June 4, 2026
datago

Works with

  • cli

Security analysis

A100/100

Scanned June 4, 2026

npx -y skills add LeoLin990405/r-analytics-skill --skill sna --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Sna?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Sna
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/leolin990405-sna/badge)](https://www.skillsdirectory.com/skills/leolin990405-sna)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: sna
description: R sna package for social network analysis. Use for network statistics and visualization with statnet.
---

# sna Package

Social network analysis tools.

## Create Network

```r
library(sna)
library(network)

# From adjacency matrix
net <- network(adj_matrix, directed = TRUE)

# From edge list
net <- network(edge_list, matrix.type = "edgelist")
```

## Centrality Measures

```r
# Degree
degree(net, cmode = "indegree")
degree(net, cmode = "outdegree")
degree(net, cmode = "freeman")

# Betweenness
betweenness(net)

# Closeness
closeness(net)

# Eigenvector
evcent(net)
```

## Network Statistics

```r
# Density
gden(net)

# Transitivity (clustering)
gtrans(net)

# Reciprocity
grecip(net)

# Centralization
centralization(net, degree)
```

## Structural Equivalence

```r
# Euclidean distance
sedist(net, method = "euclidean")

# Correlation
sedist(net, method = "correlation")

# Block modeling
equiv.clust(net)
```

## Visualization

```r
# Basic plot
gplot(net)

# With attributes
gplot(net,
  vertex.col = "blue",
  vertex.cex = degree(net) / 5,
  edge.col = "gray",
  mode = "fruchtermanreingold"
)

# Layout modes
gplot(net, mode = "circle")
gplot(net, mode = "kamadakawai")
gplot(net, mode = "mds")
```

## QAP Correlation

```r
# Quadratic Assignment Procedure
qaptest(list(net1, net2), gcor, g1 = 1, g2 = 2, reps = 1000)
```

## Dyad/Triad Census

```r
dyad.census(net)
triad.census(net)
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…