raw_data <- read.csv("data/nyakatoke_raw_data.csv")

paper_data <- read.csv("data/tanzania_data.csv")

all(raw_data$direct_link_hh1 == paper_data$willingness_link1)

all(raw_data$direct_link_hh2 == paper_data$willingness_link2)

library(igraph)

g1 <- graph_from_data_frame(paper_data[paper_data$willingness_link1 == 1 | paper_data$willingness_link2,], directed = FALSE) g1 <- simplify(g1)

g1_order <- length(V(g1)) g1_size <- length(E(g1)) g1_mean_degree <- mean(degree(g1)) g1_median_degree <- median(degree(g1)) g1_min_degree <- min(degree(g1)) g1_max_degree <- max(degree(g1)) g1_distances <- distance_table(g1)$res

g2 <- graph_from_data_frame(raw_data[raw_data$direct_link_hh1 == 1 | raw_data$direct_link_hh2,], directed = FALSE) g2 <- simplify(g2)

g2_order <- length(V(g2)) g2_size <- length(E(g2)) g2_mean_degree <- mean(degree(g2)) g2_median_degree <- median(degree(g2)) g2_min_degree <- min(degree(g2)) g2_max_degree <- max(degree(g2)) g2_distances <- distance_table(g2)$res

g1_order == g2_order g1_size == g2_size g1_mean_degree == g2_mean_degree g1_max_degree == g2_max_degree g1_median_degree == g2_median_degree g1_min_degree == g2_min_degree all(g1_distances == g2_distances)

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.