@@ -63,7 +63,7 @@ Interactions <- function(data,
6363
6464 class(interactions ) <- " Interactions"
6565
66- return ( interactions )
66+ interactions
6767}
6868
6969# ' @export
@@ -79,7 +79,7 @@ generate_network_metrics.Interactions <- function(interactions) {
7979 interactions $ top_authors_degree <- get_most_central_authors(interactions , centrality = " degree" , n = 15 )
8080 interactions $ top_authors_betweenness <- get_most_central_authors(interactions , centrality = " betweenness" , n = 15 )
8181 interactions $ top_authors_harmonic <- get_most_central_authors(interactions , centrality = " harmonic" , n = 15 )
82- return ( interactions )
82+ interactions
8383}
8484
8585generate_network_metrics <- function (interactions ) {
@@ -94,7 +94,7 @@ generate_figures.Interactions <- function(interactions, paths, date_range) {
9494 fig4 <- plot_graph(interactions , centrality = " betweenness" , output_file = paste0(paths $ figures , " /graph_betweenness_" , date_range , " .png" ))
9595 fig5 <- plot_graph(interactions , centrality = " harmonic" , output_file = paste0(paths $ figures , " /graph_harmonic_" , date_range , " .png" ))
9696 fig6 <- plot_graph(interactions , centrality = " none" , output_file = paste0(paths $ figures , " /graph_no_centrality_" , date_range , " .png" ))
97- return ( list (fig1 = fig1 , fig2 = fig2 , fig3 = fig3 , fig4 = fig4 , fig5 = fig5 , fig6 = fig6 ) )
97+ list (fig1 = fig1 , fig2 = fig2 , fig3 = fig3 , fig4 = fig4 , fig5 = fig5 , fig6 = fig6 )
9898}
9999
100100generate_figures <- function (interactions , paths , date_range ) {
@@ -106,7 +106,7 @@ get_cohesion.Interactions <- function(interactions) {
106106 dyadcount <- network :: network.dyadcount(interactions $ network )
107107 edgecount <- network :: network.edgecount(interactions $ network )
108108 size <- network :: network.size(interactions $ network )
109- return ( list (dyadcount = dyadcount , edgecount = edgecount , size = size ) )
109+ list (dyadcount = dyadcount , edgecount = edgecount , size = size )
110110}
111111
112112get_cohesion <- function (interactions ) {
@@ -136,7 +136,7 @@ get_centrality.Interactions <- function(interactions) {
136136 degree <- igraph :: degree(interactions $ graph )
137137 harmonic <- igraph :: harmonic_centrality(interactions $ graph )
138138 betweenness <- igraph :: betweenness(interactions $ graph )
139- return ( list (degree = degree , harmonic = harmonic , betweenness = betweenness ) )
139+ list (degree = degree , harmonic = harmonic , betweenness = betweenness )
140140}
141141
142142get_centrality <- function (interactions ) {
@@ -148,7 +148,7 @@ get_diameter.Interactions <- function(interactions) {
148148 diameter <- igraph :: diameter(interactions $ graph , directed = interactions $ directed , weights = NULL )
149149 shortest_paths <- igraph :: distances(interactions $ graph )
150150 average_shortest_path <- mean(shortest_paths [shortest_paths != Inf ])
151- return ( list (diameter = diameter , average_shortest_path = average_shortest_path ) )
151+ list (diameter = diameter , average_shortest_path = average_shortest_path )
152152}
153153
154154get_diameter <- function (interactions ) {
@@ -160,9 +160,7 @@ get_reachability.Interactions <- function(interactions) {
160160 reachability_matrix <- sna :: reachability(interactions $ network )
161161 num_nodes <- nrow(reachability_matrix )
162162 total_pairs <- num_nodes * (num_nodes - 1 )
163- num_unreachable_pairs <- sum(reachability_matrix == 0 ) - num_nodes
164- unreachable_fraction <- num_unreachable_pairs / total_pairs
165- return (unreachable_fraction )
163+ (sum(reachability_matrix == 0 ) - num_nodes ) / total_pairs
166164}
167165
168166get_reachability <- function (interactions ) {
0 commit comments