Skip to contents

'Creates arc diagrams for network visualization using the arcdiagram package.'

Usage

jjarcdiagram(
  data,
  source,
  target,
  weight = NULL,
  group = NULL,
  analysisPreset = "custom",
  showNodes = FALSE,
  nodeSize = "fixed",
  nodeSizeValue = 2,
  sortNodes = "none",
  sortDecreasing = FALSE,
  horizontal = FALSE,
  arcWidth = "fixed",
  arcWidthValue = 1,
  arcTransparency = 0.5,
  directed = FALSE,
  colorByGroup = FALSE,
  showStats = FALSE,
  showLegend = FALSE,
  labelSize = 0.8,
  plotTitle = ""
)

Arguments

data

The data as a data frame.

source

Starting point of each relationship or connection. Examples: Gene A regulating Gene B, Patient X similar to Patient Y, or Disease A co-occurring with Disease B.

target

Endpoint of each relationship or connection. This represents what is being regulated, influenced, or connected to by the source entity.

weight

Optional numeric measure of connection strength. Examples: Correlation coefficient, interaction score, similarity index, or co-occurrence frequency. Higher values indicate stronger relationships.

group

Optional grouping variable for color-coding entities. Examples: Gene families, patient subtypes, disease categories, or functional classifications.

analysisPreset

Choose a preset configuration optimized for specific clinical or research scenarios. Gene networks focus on regulatory relationships, patient networks on similarity patterns, pathway networks on biological processes, and comorbidity networks on disease associations.

showNodes

Whether to display node points along the arc baseline. When enabled, nodes are shown as circles at their sorted positions.

nodeSize

Method for determining node sizes. 'Fixed' uses constant size, 'By Degree' scales nodes proportionally to their connectivity (number of connections).

nodeSizeValue

Size of nodes when using fixed sizing, or base size multiplier when using degree-based sizing. Range: 0.1 to 10.

sortNodes

Order in which nodes are arranged along the baseline. 'None' preserves original order, 'By Name' sorts alphabetically, 'By Group' clusters by categories, 'By Degree' orders by connectivity.

sortDecreasing

When sorting nodes, whether to use descending order. Only applies when Sort Nodes is not 'None'.

horizontal

Layout orientation of the arc diagram. When TRUE, nodes are arranged horizontally with arcs above. When FALSE, nodes are arranged vertically with arcs to the side.

arcWidth

Method for determining arc line widths. 'Fixed' uses constant width, 'By Weight' scales arc thickness proportionally to edge weights.

arcWidthValue

Width of arcs when using fixed sizing, or base width when using weight-based sizing. Range: 0.1 to 5.

arcTransparency

Transparency level of arc lines. 0 = fully transparent (invisible), 1 = fully opaque. Lower values reduce visual clutter in dense networks.

directed

Whether to treat the network as directed (edges have direction from source to target) or undirected (edges represent bidirectional relationships).

colorByGroup

When a grouping variable is specified, whether to color-code nodes by their group membership. Requires a group variable.

showStats

Whether to display network statistics including number of nodes, edges, density, and centrality measures.

showLegend

Whether to display a color legend when nodes are colored by groups. Only appears when grouping variable is specified and color by group is enabled.

labelSize

Size of node labels (text). 0.8 is standard size, values above 1.0 increase label size, below 1.0 decrease it. Range: 0.1 to 2.0.

plotTitle

Optional title to display above the arc diagram. Leave empty for no title.

Value

A results object containing:

results$instructionsa html
results$todoa html
results$plotan image
results$networkStatsa html
results$assumptionsa html
results$reportSentencea html

Examples

# \donttest{
# Basic social network visualization
data(jjarcdiagram_social_network, package = "ClinicoPath")
#> Error in find.package(package, lib.loc, verbose = verbose): there is no package called ‘ClinicoPath’
jjarcdiagram(
    data = social_network_data,
    source = "source",
    target = "target",
    weight = "weight",
    group = "group",
    showNodes = TRUE,
    nodeSize = "degree",
    sortNodes = "group"
)
#> Error: object 'social_network_data' not found

# Gene regulatory network
data(jjarcdiagram_gene_network, package = "ClinicoPath")
#> Error in find.package(package, lib.loc, verbose = verbose): there is no package called ‘ClinicoPath’
jjarcdiagram(
    data = gene_network_data,
    source = "regulator",
    target = "target",
    weight = "regulation_score",
    group = "pathway",
    nodeSize = "degree",
    sortNodes = "group"
)
#> Error: object 'gene_network_data' not found

# Academic collaboration network
data(jjarcdiagram_academic_network, package = "ClinicoPath")
#> Error in find.package(package, lib.loc, verbose = verbose): there is no package called ‘ClinicoPath’
jjarcdiagram(
    data = academic_network_data,
    source = "author1",
    target = "author2",
    weight = "publications",
    group = "department",
    showNodes = TRUE,
    nodeSize = "degree"
)
#> Error: object 'academic_network_data' not found

# Organizational hierarchy
data(jjarcdiagram_org_hierarchy, package = "ClinicoPath")
#> Error in find.package(package, lib.loc, verbose = verbose): there is no package called ‘ClinicoPath’
jjarcdiagram(
    data = org_hierarchy_data,
    source = "employee",
    target = "reports_to",
    weight = "relationship_strength",
    group = "department",
    nodeSize = "fixed",
    nodeSizeValue = 3
)
#> Error: object 'org_hierarchy_data' not found

# Simple minimal network
data(jjarcdiagram_minimal_network, package = "ClinicoPath")
#> Error in find.package(package, lib.loc, verbose = verbose): there is no package called ‘ClinicoPath’
jjarcdiagram(
    data = minimal_network_data,
    source = "from",
    target = "to",
    weight = "strength"
)
#> Error: object 'minimal_network_data' not found
# }