@@ -66,7 +66,7 @@ calculate_similarity <- function(x, min_matches = 6, align_poles = TRUE) #, use_
6666  if  (align_poles ) {
6767    x  <-  align_positive_poles(x )
6868  }
69-      
69+   
7070  s  <-  x [, i_ratings ]   #  remove construct poles
7171  S  <-  as.matrix(s )
7272  pole_left  <-  x [, i_left ]
@@ -98,7 +98,7 @@ calculate_similarity <- function(x, min_matches = 6, align_poles = TRUE) #, use_
9898  Mi_vec  <-  as.vector(Mi )
9999  R [, ] <-  ifelse(M_vec  >  Mi_vec , M_vec , Mi_vec )
100100  diag(R ) <-  NA 
101- 
101+    
102102  diag(M ) <-  NA    #  exlude match to self
103103  diag(Mi ) <-  NA   #  exlude match to self
104104
@@ -130,8 +130,8 @@ calculate_similarity <- function(x, min_matches = 6, align_poles = TRUE) #, use_
130130  names(pole_right ) <-  labels 
131131  names(valence_left ) <-  labels 
132132  names(valence_right ) <-  labels 
133- 
134-   list (R  =  R ,    #  no of matches (indlucing  optional construct reversal, i.e. only high no. of matches relevant
133+    
134+   list (R  =  R ,    #  no of matches (inclucing  optional construct reversal, i.e. only high no. of matches relevant
135135       M  =  M ,    #  matrix of matches without optional construct reversal, as described in paper, i.e. a very low and very high number of matches relevant
136136       MM  =  MM ,  #  relatedness 0/1
137137       D  =  D ,    #  direction of relation -1/1
@@ -192,7 +192,7 @@ clique_color_pals <- function(n, name = "Dark2", alpha = .1)
192192    )
193193    return (l )
194194  }
195-      
195+   
196196  pals  <-  RColorBrewer :: brewer.pal.info 
197197  n_max  <-  pals [name , ]$ maxcolors   #  max umber of avaiabke colors in palette
198198  cols  <-  RColorBrewer :: brewer.pal(n_max , name )  #  build palette
@@ -214,7 +214,7 @@ clique_color_pals <- function(n, name = "Dark2", alpha = .1)
214214add_image_border  <-  function (color  =  NA ) 
215215{
216216  if  ( is.null(color ) ||  is.na(color ) )
217-        return (NULL )
217+     return (NULL )
218218  graphics :: box(which  =  " outer" lty  =  " solid" col  =  color )
219219}
220220
@@ -327,7 +327,7 @@ network_graph_images <- function(x,
327327
328328  nms_keep  <-  clique_lists  %> % unlist  %> % unique 
329329  MM2  <-  MM [nms_keep , nms_keep ]
330- 
330+    
331331  #  colorize edges by direction
332332  edges  <-  ends(g , E(g ))   #  edge from to as rowwise matrix
333333  edge_directions  <-  D [edges ]
@@ -336,7 +336,7 @@ network_graph_images <- function(x,
336336  } else  {
337337    edge_labels  <-  NULL 
338338  }
339-      
339+   
340340  if  (colorize_direction ) {
341341    edge_colors  <-  recode(edge_directions , `1`  =  " darkgreen" `-1`  =  " red" .default  =  " grey" 
342342    edge_label_colors  <-  edge_colors 
@@ -345,8 +345,8 @@ network_graph_images <- function(x,
345345    edge_label_colors  <-  grey(.2 )
346346  }
347347  E(g )$ color  <-  edge_colors 
348- 
349- 
348+    
349+    
350350  # #__ all - abbreviated   ----------------------------------------------
351351
352352  vertex.labels  <-  NULL 
@@ -380,7 +380,7 @@ network_graph_images <- function(x,
380380  })
381381  add_image_border(image_border_color )
382382  dev.off()
383- 
383+    
384384
385385  #  __ all - full labels ----------------------------------------------
386386
@@ -420,19 +420,19 @@ network_graph_images <- function(x,
420420                        vertex.label.family  =  " sans" 
421421                        vertex.color  =  grey(.9 ),
422422                        vertex.frame.color  =  grey(.5 ))
423- 
423+      
424424  })
425425  add_image_border(image_border_color )
426426  dev.off()
427427
428- 
428+    
429429  # #__ all - separate poles  ----------------------------------------------
430430
431431  label_wrap_width  <-  14 
432432  cnames  <-  paste( prep_label(l $ pole_left , label_max_length  =  label_max_length ), " @" 
433433                   prep_label(l $ pole_right , label_max_length  =  label_max_length ))
434434  names(cnames ) <-  names(l $ constructs )
435- 
435+    
436436  cns  <-  V(g )$ name 
437437  ii_keep  <-  match(cns , names(cnames ))
438438  vertex.labels  <- 
@@ -441,7 +441,7 @@ network_graph_images <- function(x,
441441  vertex.size  <-  22 
442442  vertex.label.cex  <-  .5 
443443  edge_labels  <-  NULL 
444- 
444+    
445445  #  find vertexes with negative relations only => we need to separate by direction
446446  D2  <-  D [ii_keep , ii_keep ]
447447  vertex_relations  <-  apply(D2 , 2 , function (x ) {
@@ -457,10 +457,10 @@ network_graph_images <- function(x,
457457  names(vertex_relations ) <-  cns 
458458  vertex_font_pole_1  <-  1  #  recode(vertex_relations, "neg" = 2, .default = 1)
459459  vertex_font_pole_2  <-  1  #  recode(vertex_relations, "neg" = 1, .default = 2)
460- 
460+    
461461  vertex.labels1  <-  replace_all(vertex.labels , first  =  TRUE )
462462  vertex.labels2  <-  replace_all(vertex.labels , first  =  FALSE )
463- 
463+    
464464  #  colorize edges by direction
465465  edges  <-  ends(g , E(g ))   #  edge from to as rowwise matrix
466466  edge_directions  <-  D [edges ]
@@ -514,7 +514,7 @@ network_graph_images <- function(x,
514514                        vertex.label.font  =  vertex_font_pole_1 ,
515515                        vertex.color  =  grey(.9 ),
516516                        vertex.frame.color  =  grey(.5 ))
517-   
517+      
518518    set.seed(seed )
519519    igraph :: plot.igraph(g , add  =  TRUE ,
520520                        mark.groups  =  NULL ,
@@ -568,7 +568,7 @@ network_graph_images <- function(x,
568568    cnames [cns ] %> %
569569    str_sub(start  =  1 , end  =  label_max_length ) %> %
570570    str_wrap(width  =  label_wrap_width )
571- 
571+    
572572  #  abbreviated construct labels
573573  vertex.labels  <-  NULL 
574574  vertex.size  =  30 
@@ -622,7 +622,7 @@ network_graph_images <- function(x,
622622  vertex.label.cex  <-  .6 
623623
624624  img_cliques_only_full_labels  <-  tempfile(fileext  =  " .png" 
625- 
625+    
626626  png(img_cliques_only_full_labels , width  =  20 , height  =  20 , units  =  " cm" res  =  300 )
627627  with_par(img_par , {
628628    set.seed(seed )
0 commit comments