# NOT RUN {
W <- matrix(sample(0:5, 100, replace = TRUE), 10) #Random weighted graph
diag(W) <- 0
W
global(W, narrative = TRUE) #Keep all non-zero edges
global(W, upper = 4, lower = 2, narrative = TRUE) #Signed with specified thresholds
global(W, upper = function(x)mean(x), #Above-average --> positive edges
lower = function(x)mean(x), narrative = TRUE) #Below-average --> negative edges
# }
Run the code above in your browser using DataLab