pipe_trace_paths: Trace paths

pipe_trace_pathsR Documentation

Trace paths

Description

This is a powerful command which allows the user to trace paths from one or more upstream factors to one or more downstream factors. Only links which are part of such paths are displayed.

Usage

pipe_trace_paths(
  graf,
  from = "",
  to = "",
  length = 4,
  remove_links = F,
  threads_direction = "none",
  field = "source_id",
  calculate_robustness = F
)

Arguments

graf

A causal map.

from

A character vector of factors to start the trace from.

to

A character vector of factors to end the trace at.

length

The maximum length of the paths to trace.

remove_links

If 'TRUE', links that are not part of the traced paths will be removed from the causal map.

threads_direction

The direction in which to trace threads. Valid values are '"up"', '"down"', and '"none"'.

field

The field to use to identify threads. Valid values are '"source_id"' and '"target_id"'.

calculate_robustness

If 'TRUE', the robustness of the traced paths will be calculated.

Value

A causal map with the traced paths.

Examples

graf <- create_causal_map()

# Trace paths from "A" to "C".
paths <- pipe_trace_paths(graf, from = "A", to = "C")

# Trace paths from "A" to "C" with a maximum length of 2.
paths <- pipe_trace_paths(graf, from = "A", to = "C", length = 2)

# Trace paths from "A" to "C" and remove links that are not part of the traced paths.
paths <- pipe_trace_paths(graf, from = "A", to = "C", remove_links = TRUE)

# Trace paths from "A" to "C" in the "up" direction.
paths <- pipe_trace_paths(graf, from = "A", to = "C", threads_direction = "up")

# Trace paths from "A" to "C" using the "source_id" field to identify threads.
paths <- pipe_trace_paths(graf, from = "A", to = "C", field = "source_id")

# Trace paths from "A" to "C" and calculate the robustness of the traced paths.
paths <- pipe_trace_paths(graf, from = "A", to = "C", calculate_robustness = TRUE)

stevepowell99/CausalMapFunctions documentation built on Oct. 12, 2023, 11:13 a.m.