rich-iannone / DiagrammeR

@@ -319,7 +319,7 @@
Loading
319 319
      starting_edges %>%
320 320
      dplyr::semi_join(valid_nodes, by = "to") %>%
321 321
      dplyr::left_join(edf, by = c("edge" = "id")) %>%
322 -
      dplyr::select_("to.y", copy_attrs_from)
322 +
      dplyr::select("to.y",!! enquo(copy_attrs_from))
323 323
324 324
325 325
    if (!is.null(copy_attrs_as)) {
@@ -338,10 +338,9 @@
Loading
338 338
      nodes %>%
339 339
      dplyr::rename(id = to.y) %>%
340 340
      dplyr::group_by(id) %>%
341 -
      dplyr::summarize_(.dots = stats::setNames(
342 -
        list(stats::as.formula(
343 -
          paste0("~", agg, "(", copy_attrs_from, ", na.rm = TRUE)"))),
344 -
        copy_attrs_from)) %>%
341 +
      dplyr::summarize(!! copy_attrs_from :=
342 +
                         match.fun(!! agg)(!! as.name(copy_attrs_from),
343 +
                                           na.rm = TRUE)) %>%
345 344
      dplyr::right_join(ndf, by = "id") %>%
346 345
      dplyr::select(id, type, label, dplyr::everything()) %>%
347 346
      as.data.frame(stringsAsFactors = FALSE)

@@ -312,7 +312,7 @@
Loading
312 312
    ndf_2 <-
313 313
      ndf %>%
314 314
      dplyr::filter(id %in% starting_nodes) %>%
315 -
      dplyr::select_("id", copy_attrs_from)
315 +
      dplyr::select("id",!! enquo(copy_attrs_from))
316 316
317 317
    if (!is.null(copy_attrs_as)) {
318 318

@@ -318,7 +318,7 @@
Loading
318 318
      starting_edges %>%
319 319
      dplyr::semi_join(valid_nodes, by = "from") %>%
320 320
      dplyr::left_join(edf, by = c("edge" = "id")) %>%
321 -
      dplyr::select_("from.y", copy_attrs_from)
321 +
      dplyr::select("from.y",!! enquo(copy_attrs_from))
322 322
323 323
    if (!is.null(copy_attrs_as)) {
324 324
@@ -336,10 +336,9 @@
Loading
336 336
      nodes %>%
337 337
      dplyr::rename(id = from.y) %>%
338 338
      dplyr::group_by(id) %>%
339 -
      dplyr::summarize_(.dots = stats::setNames(
340 -
        list(stats::as.formula(
341 -
          paste0("~", agg, "(", copy_attrs_from, ", na.rm = TRUE)"))),
342 -
        copy_attrs_from)) %>%
339 +
      dplyr::summarize(!! copy_attrs_from :=
340 +
                         match.fun(!! agg)(!! as.name(copy_attrs_from),
341 +
                                           na.rm = TRUE)) %>%
343 342
      dplyr::right_join(ndf, by = "id") %>%
344 343
      dplyr::select(id, type, label, dplyr::everything()) %>%
345 344
      as.data.frame(stringsAsFactors = FALSE)

@@ -173,53 +173,17 @@
Loading
173 173
      get_edge_ids(graph),
174 174
      suppressMessages(get_selection(graph)))
175 175
176 -
  for (i in 1:length(exprs)) {
177 -
178 -
    # Case where mutation occurs for an
179 -
    # existing edge attribute
180 -
    if (names(exprs)[i] %in% colnames(edf)) {
181 -
182 -
      edf_replacement <-
183 -
        edf %>%
184 -
        dplyr::mutate_(
185 -
          .dots = stats::setNames(list((exprs %>% paste())[i]),
186 -
                           names(exprs)[i]))
187 -
188 -
      edf_replacement[
189 -
        which(edf$id %in% unselected_edges), ] <-
190 -
        edf[
191 -
          which(edf$id %in% unselected_edges), ]
192 -
193 -
      # Update the graph's edf
194 -
      graph$edges_df <- edf_replacement
195 -
196 -
      # Reobtain the changed edf for
197 -
      # any subsequent mutations
198 -
      edf <- get_edge_df(graph)
199 -
    }
200 -
201 -
    # Case where mutation creates a
202 -
    # new edge attribute
203 -
    if (!(names(exprs)[i] %in% colnames(edf))) {
204 -
205 -
      edf_replacement <-
206 -
        edf %>%
207 -
        dplyr::mutate_(
208 -
          .dots = stats::setNames(list((exprs %>% paste())[i]),
209 -
                           names(exprs)[i]))
210 -
211 -
      edf_replacement[
212 -
        which(edf$id %in% unselected_edges),
213 -
        which(colnames(edf_replacement) == names(exprs)[i])] <- NA
214 -
215 -
      # Update the graph's edf
216 -
      graph$edges_df <- edf_replacement
217 -
218 -
      # Reobtain the changed edf for
219 -
      # any subsequent mutations
220 -
      edf <- get_edge_df(graph)
221 -
    }
222 -
  }
176 +
  s <- edf$id %in% unselected_edges
177 +
  order <- c(which(!s), which(s))
178 +
179 +
  edf <-
180 +
    dplyr::bind_rows(
181 +
      edf %>% dplyr::filter(!(!! enquo(s))) %>% dplyr::mutate(!!! enquos(...)),
182 +
      edf %>% dplyr::filter( (!! enquo(s)))
183 +
    ) %>% dplyr::arrange(!! enquo(order))
184 +
185 +
  graph$edges_df <- edf
186 +
223 187
224 188
  # Update the `graph_log` df with an action
225 189
  graph$graph_log <-

@@ -294,7 +294,7 @@
Loading
294 294
    ndf_2 <-
295 295
      ndf %>%
296 296
      dplyr::filter(id %in% starting_nodes) %>%
297 -
      dplyr::select_("id", copy_attrs_from)
297 +
      dplyr::select("id",!! enquo(copy_attrs_from))
298 298
299 299
    if (!is.null(copy_attrs_as)) {
300 300

@@ -114,13 +114,7 @@
Loading
114 114
      reasons = "The variable `id` cannot undergo mutation")
115 115
  }
116 116
117 -
  for (i in 1:length(exprs)) {
118 -
    ndf <-
119 -
      ndf %>%
120 -
      dplyr::mutate_(
121 -
        .dots = stats::setNames(list((exprs %>% paste())[i]),
122 -
                         names(exprs)[i]))
123 -
  }
117 +
  ndf <- ndf %>% dplyr::mutate(!!! enquos(...))
124 118
125 119
  # Update the graph
126 120
  graph$nodes_df <- ndf

@@ -111,11 +111,12 @@
Loading
111 111
112 112
  # Get the aggregate value of total degree based
113 113
  # on the aggregate function provided
114 +
  fun <- match.fun(agg)
115 +
114 116
  indegree_agg <-
115 117
    indegree_df %>%
116 118
    dplyr::group_by() %>%
117 -
    dplyr::summarize_(stats::as.formula(
118 -
      paste0("~", agg, "(indegree, na.rm = TRUE)"))) %>%
119 +
    dplyr::summarize(fun(indegree, na.rm = TRUE)) %>%
119 120
    dplyr::ungroup() %>%
120 121
    purrr::flatten_dbl()
121 122

@@ -305,24 +305,23 @@
Loading
305 305
      valid_nodes %>%
306 306
      dplyr::select(id) %>%
307 307
      dplyr::inner_join(edf %>% dplyr::select(from, to), by = c("id" = "from")) %>%
308 -
      dplyr::inner_join(ndf %>% dplyr::select_("id", copy_attrs_from), by = c("to" = "id")) %>%
309 -
      dplyr::select_("id", copy_attrs_from)
308 +
      dplyr::inner_join(ndf %>% dplyr::select("id",!! enquo(copy_attrs_from)), by = c("to" = "id")) %>%
309 +
      dplyr::select("id",!! enquo(copy_attrs_from))
310 310
311 311
    to_join <-
312 312
      valid_nodes %>%
313 313
      dplyr::select(id) %>%
314 314
      dplyr::inner_join(edf %>% dplyr::select(from, to), by = c("id" = "to")) %>%
315 -
      dplyr::inner_join(ndf %>% dplyr::select_("id", copy_attrs_from), by = c("from" = "id")) %>%
316 -
      dplyr::select_("id", copy_attrs_from)
315 +
      dplyr::inner_join(ndf %>% dplyr::select("id",!! enquo(copy_attrs_from)), by = c("from" = "id")) %>%
316 +
      dplyr::select("id",!! enquo(copy_attrs_from))
317 317
318 318
    nodes <-
319 319
      from_join %>%
320 320
      dplyr::union_all(to_join) %>%
321 321
      dplyr::group_by(id) %>%
322 -
      dplyr::summarize_(.dots = stats::setNames(
323 -
        list(stats::as.formula(
324 -
          paste0("~", agg, "(", copy_attrs_from, ", na.rm = TRUE)"))),
325 -
        copy_attrs_from)) %>%
322 +
      dplyr::summarize(!! copy_attrs_from :=
323 +
                         match.fun(!! agg)(!! as.name(copy_attrs_from),
324 +
                                           na.rm = TRUE)) %>%
326 325
      dplyr::right_join(ndf, by = "id") %>%
327 326
      dplyr::select(id, type, label, dplyr::everything()) %>%
328 327
      as.data.frame(stringsAsFactors = FALSE)

@@ -328,8 +328,8 @@
Loading
328 328
      valid_nodes %>%
329 329
      dplyr::select(id) %>%
330 330
      dplyr::inner_join(edf %>% dplyr::select(from, to), by = c("id" = "to")) %>%
331 -
      dplyr::inner_join(ndf %>% dplyr::select_("id", copy_attrs_from), by = c("from" = "id")) %>%
332 -
      dplyr::select_("id", copy_attrs_from)
331 +
      dplyr::inner_join(ndf %>% dplyr::select("id",!! enquo(copy_attrs_from)), by = c("from" = "id")) %>%
332 +
      dplyr::select("id",!! enquo(copy_attrs_from))
333 333
334 334
    # If the values to be copied are numeric,
335 335
    # perform aggregation on the values
@@ -337,10 +337,9 @@
Loading
337 337
      nodes <-
338 338
        nodes %>%
339 339
        dplyr::group_by(id) %>%
340 -
        dplyr::summarize_(.dots = stats::setNames(
341 -
          list(stats::as.formula(
342 -
            paste0("~", agg, "(", copy_attrs_from, ", na.rm = TRUE)"))),
343 -
          copy_attrs_from)) %>%
340 +
        dplyr::summarize(!! copy_attrs_from :=
341 +
                           match.fun(!! agg)(!! as.name(copy_attrs_from),
342 +
                                             na.rm = TRUE)) %>%
344 343
        dplyr::ungroup()
345 344
    }
346 345

@@ -111,11 +111,12 @@
Loading
111 111
112 112
  # Get the aggregate value of total degree based
113 113
  # on the aggregate function provided
114 +
  fun <- match.fun(agg)
115 +
114 116
  outdegree_agg <-
115 117
    outdegree_df %>%
116 118
    dplyr::group_by() %>%
117 -
    dplyr::summarize_(stats::as.formula(
118 -
      paste0("~", agg, "(outdegree, na.rm = TRUE)"))) %>%
119 +
    dplyr::summarize(fun(outdegree, na.rm = TRUE)) %>%
119 120
    dplyr::ungroup() %>%
120 121
    purrr::flatten_dbl()
121 122

@@ -173,53 +173,16 @@
Loading
173 173
      get_node_ids(graph),
174 174
      suppressMessages(get_selection(graph)))
175 175
176 -
  for (i in 1:length(exprs)) {
177 -
178 -
    # Case where mutation occurs for an
179 -
    # existing node attribute
180 -
    if (names(exprs)[i] %in% colnames(ndf)) {
181 -
182 -
      ndf_replacement <-
183 -
        ndf %>%
184 -
        dplyr::mutate_(
185 -
          .dots = stats::setNames(list((exprs %>% paste())[i]),
186 -
                           names(exprs)[i]))
187 -
188 -
      ndf_replacement[
189 -
        which(ndf$id %in% unselected_nodes), ] <-
190 -
        ndf[
191 -
          which(ndf$id %in% unselected_nodes), ]
192 -
193 -
      # Update the graph's ndf
194 -
      graph$nodes_df <- ndf_replacement
195 -
196 -
      # Reobtain the changed ndf for
197 -
      # any subsequent mutations
198 -
      ndf <- get_node_df(graph)
199 -
    }
200 -
201 -
    # Case where mutation creates a
202 -
    # new node attribute
203 -
    if (!(names(exprs)[i] %in% colnames(ndf))) {
204 -
205 -
      ndf_replacement <-
206 -
        ndf %>%
207 -
        dplyr::mutate_(
208 -
          .dots = stats::setNames(list((exprs %>% paste())[i]),
209 -
                           names(exprs)[i]))
210 -
211 -
      ndf_replacement[
212 -
        which(ndf$id %in% unselected_nodes),
213 -
        which(colnames(ndf_replacement) == names(exprs)[i])] <- NA
214 -
215 -
      # Update the graph's ndf
216 -
      graph$nodes_df <- ndf_replacement
217 -
218 -
      # Reobtain the changed ndf for
219 -
      # any subsequent mutations
220 -
      ndf <- get_node_df(graph)
221 -
    }
222 -
  }
176 +
  s <- ndf$id %in% unselected_nodes
177 +
  order <- c(which(!s), which(s))
178 +
179 +
  ndf <-
180 +
    dplyr::bind_rows(
181 +
      ndf %>% dplyr::filter(!(!! enquo(s))) %>% dplyr::mutate(!!! enquos(...)),
182 +
      ndf %>% dplyr::filter( (!! enquo(s)))
183 +
    ) %>% dplyr::arrange(!! enquo(order))
184 +
185 +
  graph$nodes_df <- ndf
223 186
224 187
  # Update the `graph_log` df with an action
225 188
  graph$graph_log <-

@@ -114,11 +114,12 @@
Loading
114 114
115 115
  # Get the aggregate value of total degree based
116 116
  # on the aggregate function provided
117 +
  fun <- match.fun(agg)
118 +
117 119
  total_degree_agg <-
118 120
    total_degree_df %>%
119 121
    dplyr::group_by() %>%
120 -
    dplyr::summarize_(stats::as.formula(
121 -
      paste0("~", agg, "(total_degree, na.rm = TRUE)"))) %>%
122 +
    dplyr::summarize(fun(total_degree, na.rm = TRUE)) %>%
122 123
    dplyr::ungroup() %>%
123 124
    purrr::flatten_dbl()
124 125

@@ -116,9 +116,9 @@
Loading
116 116
  if (return_values == "label") {
117 117
    edges_df <-
118 118
      edges_df %>%
119 -
      dplyr::left_join(graph$nodes_df %>% dplyr::select_("id", "label"), by = c("from" = "id")) %>%
119 +
      dplyr::left_join(graph$nodes_df %>% dplyr::select("id", "label"), by = c("from" = "id")) %>%
120 120
      dplyr::rename(from_label_ = label) %>%
121 -
      dplyr::left_join(graph$nodes_df %>% dplyr::select_("id", "label"), by = c("to" = "id")) %>%
121 +
      dplyr::left_join(graph$nodes_df %>% dplyr::select("id", "label"), by = c("to" = "id")) %>%
122 122
      dplyr::rename(to_label_ = label)
123 123
  }
124 124
@@ -159,11 +159,11 @@
Loading
159 159
    if (return_values == "id") {
160 160
      edges_df <-
161 161
        edges_df %>%
162 -
        dplyr::select_("from", "to")
162 +
        dplyr::select("from", "to")
163 163
    } else if (return_values == "label") {
164 164
      edges_df <-
165 165
        edges_df %>%
166 -
        dplyr::select_("from_label_", "to_label_")
166 +
        dplyr::select("from_label_", "to_label_")
167 167
    }
168 168
169 169
    return(edges_df)

@@ -136,7 +136,7 @@
Loading
136 136
          trimws() %>%
137 137
          stringr::str_split(" ") %>%
138 138
          purrr::flatten_chr() %>%
139 -
          dplyr::as_tibble(.name_repair = "unique") %>%
139 +
          tibble::enframe(name = NULL) %>%
140 140
          tidyr::drop_na() %>%
141 141
          dplyr::distinct() %>%
142 142
          purrr::flatten_chr())

@@ -306,25 +306,25 @@
Loading
306 306
307 307
      from_join <-
308 308
        ndf %>%
309 -
        dplyr::select_("id", copy_attrs_from) %>%
309 +
        dplyr::select("id",!! enquo(copy_attrs_from)) %>%
310 310
        dplyr::filter(id %in% starting_nodes) %>%
311 311
        dplyr::right_join(
312 312
          valid_edges %>%
313 313
            dplyr::select(-rel) %>%
314 314
            dplyr::rename(e_id = id),
315 315
          by = c("id" = "from")) %>%
316 -
        dplyr::select_("e_id", copy_attrs_from)
316 +
        dplyr::select("e_id",!! enquo(copy_attrs_from))
317 317
318 318
      to_join <-
319 319
        ndf %>%
320 -
        dplyr::select_("id", copy_attrs_from) %>%
320 +
        dplyr::select("id",!! enquo(copy_attrs_from)) %>%
321 321
        dplyr::filter(id %in% starting_nodes) %>%
322 322
        dplyr::right_join(
323 323
          valid_edges %>%
324 324
            dplyr::select(-rel) %>%
325 325
            dplyr::rename(e_id = id),
326 326
          by = c("id" = "to")) %>%
327 -
        dplyr::select_("e_id", copy_attrs_from)
327 +
        dplyr::select("e_id",!! enquo(copy_attrs_from))
328 328
329 329
      if (!is.null(copy_attrs_as)) {
330 330
@@ -346,10 +346,9 @@
Loading
346 346
        dplyr::left_join(edf, by = c("e_id" = "id")) %>%
347 347
        dplyr::rename(id = e_id) %>%
348 348
        dplyr::group_by(id) %>%
349 -
        dplyr::summarize_(.dots = stats::setNames(
350 -
          list(stats::as.formula(
351 -
            paste0("~", agg, "(", copy_attrs_from, ", na.rm = TRUE)"))),
352 -
          copy_attrs_from)) %>%
349 +
        dplyr::summarize(!! copy_attrs_from :=
350 +
                           match.fun(!! agg)(!! as.name(copy_attrs_from),
351 +
                                             na.rm = TRUE)) %>%
353 352
        dplyr::right_join(edf, by = "id") %>%
354 353
        dplyr::select(id, from, to, rel, dplyr::everything()) %>%
355 354
        as.data.frame(stringsAsFractions = FALSE)
@@ -359,7 +358,7 @@
Loading
359 358
360 359
      from_join <-
361 360
        ndf %>%
362 -
        dplyr::select_("id", copy_attrs_from) %>%
361 +
        dplyr::select("id",!! enquo(copy_attrs_from)) %>%
363 362
        dplyr::filter(id %in% starting_nodes)
364 363
365 364
      if (!is.null(copy_attrs_as)) {
@@ -403,11 +402,11 @@
Loading
403 402
      # Drop the ".x" column
404 403
      from_join <-
405 404
        from_join %>%
406 -
        dplyr::select_("e_id", copy_attrs_from)
405 +
        dplyr::select("e_id",!! enquo(copy_attrs_from))
407 406
408 407
      to_join <-
409 408
        ndf %>%
410 -
        dplyr::select_("id", copy_attrs_from) %>%
409 +
        dplyr::select("id",!! enquo(copy_attrs_from)) %>%
411 410
        dplyr::filter(id %in% starting_nodes)
412 411
413 412
      if (!is.null(copy_attrs_as)) {
@@ -449,7 +448,7 @@
Loading
449 448
      # Drop the ".x" column
450 449
      to_join <-
451 450
        to_join %>%
452 -
        dplyr::select_("e_id", copy_attrs_from)
451 +
        dplyr::select("e_id",!! enquo(copy_attrs_from))
453 452
454 453
      edges <-
455 454
        dplyr::bind_rows(
@@ -482,9 +481,9 @@
Loading
482 481
        dplyr::arrange(e_id) %>%
483 482
        dplyr::rename(id = e_id) %>%
484 483
        dplyr::group_by(id) %>%
485 -
        dplyr::summarize_(.dots = stats::setNames(
486 -
          list(stats::as.formula(
487 -
            paste0("~", agg, "(", copy_attrs_from, ", na.rm = TRUE)"))), copy_attrs_from)) %>%
484 +
        dplyr::summarize(!! copy_attrs_from :=
485 +
                            match.fun(!! agg)(!! as.name(copy_attrs_from),
486 +
                                              na.rm = TRUE)) %>%
488 487
        dplyr::ungroup() %>%
489 488
        dplyr::right_join(edf, by = "id")
490 489

@@ -184,19 +184,19 @@
Loading
184 184
    # Filter the graph `ndf`
185 185
    ndf_part <-
186 186
      ndf %>%
187 -
      dplyr::filter_(paste0(node_attr, " == '", node_attr_val, "'"))
187 +
      dplyr::filter(!! parse_expr(paste0(node_attr, " == '", node_attr_val, "'")))
188 188
189 189
    # Optionally apply sorting
190 190
    if (!is.null(sort)) {
191 191
      if (sort_dir == "desc") {
192 192
        ndf_part <-
193 193
          ndf_part %>%
194 -
          dplyr::arrange_(paste0("desc(", sort_attr, ")"))
194 +
          dplyr::arrange(desc(!! sym(sort_attr)))
195 195
196 196
      } else {
197 197
        ndf_part <-
198 198
          ndf_part %>%
199 -
          dplyr::arrange_(sort_attr)
199 +
          dplyr::arrange(!! sym(sort_attr))
200 200
      }
201 201
    }
202 202

@@ -325,8 +325,8 @@
Loading
325 325
      valid_nodes %>%
326 326
      dplyr::select(id) %>%
327 327
      dplyr::inner_join(edf %>% dplyr::select(from, to), by = c("id" = "from")) %>%
328 -
      dplyr::inner_join(ndf %>% dplyr::select_("id", copy_attrs_from), by = c("to" = "id")) %>%
329 -
      dplyr::select_("id", copy_attrs_from)
328 +
      dplyr::inner_join(ndf %>% dplyr::select("id",!! enquo(copy_attrs_from)), by = c("to" = "id")) %>%
329 +
      dplyr::select("id",!! enquo(copy_attrs_from))
330 330
331 331
    # If the values to be copied are numeric,
332 332
    # perform aggregation on the values
@@ -334,10 +334,9 @@
Loading
334 334
      nodes <-
335 335
        nodes %>%
336 336
        dplyr::group_by(id) %>%
337 -
        dplyr::summarize_(.dots = stats::setNames(
338 -
          list(stats::as.formula(
339 -
            paste0("~", agg, "(", copy_attrs_from, ", na.rm = TRUE)"))),
340 -
          copy_attrs_from)) %>%
337 +
        dplyr::summarize(!! copy_attrs_from :=
338 +
                           match.fun(!! agg)(!! as.name(copy_attrs_from),
339 +
                                             na.rm = TRUE)) %>%
341 340
        dplyr::ungroup()
342 341
    }
343 342

@@ -54,7 +54,7 @@
Loading
54 54
  # exclude the `id` column
55 55
  edf <-
56 56
    graph$edges_df %>%
57 -
    dplyr::select_("-id")
57 +
    dplyr::select(-id)
58 58
59 59
  igraph::graph_from_data_frame(
60 60
    d = edf,

@@ -240,12 +240,12 @@
Loading
240 240
241 241
  # Are all values not NA?
242 242
  all_is_not_na <-
243 -
    df %>% dplyr::select_(attr) %>%
243 +
    df %>% dplyr::select(!! enquo(attr)) %>%
244 244
    is.na %>% magrittr::not() %>% all()
245 245
246 246
  # Are all values distinct?
247 247
  all_values_distinct <-
248 -
    df %>% dplyr::select_(attr) %>% dplyr::distinct() %>% nrow() ==
248 +
    df %>% dplyr::select(!! enquo(attr)) %>% dplyr::distinct() %>% nrow() ==
249 249
    nrow(df)
250 250
251 251
  if (all_is_not_na & all_values_distinct) {

@@ -113,44 +113,16 @@
Loading
113 113
  edf <- graph$edges_df
114 114
115 115
  # Get the available reverse edges
116 -
  reverse_edges <-
117 -
    edf %>%
118 -
    {
119 -
      reverse_edges <- dplyr::as_tibble()
120 -
      for (i in 1:length(edges_to)) {
121 -
        reverse_edges <-
122 -
          edf %>%
123 -
          dplyr::filter_(
124 -
            paste0(
125 -
              "from == ",
126 -
              edges_to[i],
127 -
              " & to == ",
128 -
              edges_from[i])) %>%
129 -
          dplyr::bind_rows(reverse_edges)
130 -
      }
131 -
      reverse_edges
132 -
    }
116 +
  reverse_edges_df <- data.frame(to = edges_from, from = edges_to)
117 +
  reverse_edges <- edf %>% dplyr::inner_join(reverse_edges_df)
133 118
134 119
  # Add the reverse edges to the existing,
135 120
  # selected edges
136 121
  if (add_to_selection) {
122 +
    edges_df <- data.frame(to = edges_to, from = edges_from)
137 123
    edges <-
138 124
      edf %>%
139 -
      {
140 -
        edges <- dplyr::as_tibble()
141 -
        for (i in 1:length(edges_to)) {
142 -
          edges <-
143 -
            edf %>%
144 -
            dplyr::filter_(
145 -
              paste0(
146 -
                "from == ",
147 -
                edges_from[i],
148 -
                " & to == ",
149 -
                edges_to[i])) %>%
150 -
            dplyr::bind_rows(edges)
151 -
        }
152 -
        edges
153 -
      } %>%
125 +
      dplyr::inner_join(edges_df) %>%
154 126
      dplyr::bind_rows(reverse_edges)
155 127
  } else {
156 128
    edges <- reverse_edges

@@ -116,13 +116,7 @@
Loading
116 116
      reasons = "The variables `id`, `from`, or `to` cannot undergo mutation")
117 117
  }
118 118
119 -
  for (i in 1:length(exprs)) {
120 -
    edf <-
121 -
      edf %>%
122 -
      dplyr::mutate_(
123 -
        .dots = stats::setNames(list((exprs %>% paste())[i]),
124 -
                         names(exprs)[i]))
125 -
  }
119 +
  edf <- edf %>% dplyr::mutate(!!! enquos(...))
126 120
127 121
  # Update the graph
128 122
  graph$edges_df <- edf

@@ -123,13 +123,8 @@
Loading
123 123
  # Get a data frame with node ID and degree types
124 124
  node_degree <-
125 125
    get_node_info(graph) %>%
126 -
    dplyr::select(id, deg, indeg, outdeg)
127 -
128 -
  for (i in 1:length(expressions)) {
129 -
    node_degree <-
130 -
      node_degree %>%
131 -
      dplyr::filter_(expressions[i])
132 -
  }
126 +
    dplyr::select(id, deg, indeg, outdeg) %>%
127 +
    dplyr::filter(!!! parse_exprs(expressions))
133 128
134 129
  # Get the node ID values from the filtered table
135 130
  nodes_selected <- node_degree$id
Files Coverage
R 81.45%
Project Totals (244 files) 81.45%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading