Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

add.node

Add a node to an existing DAG.


Description

Conveniently adds a node to an existing DAG, inserting its coordinates and label before the outcome node. Also updates the arcs correspondingly.

Usage

add.node(dag, name = "unknown", type = 1, x = NA, y = NA)

Arguments

dag

The DAG to which the node is to be added.

name

Label for the node (defaults to "unknown").

type

Type of node (1=covariable, 2=unknown); defaults to 1.

x

X coordinate for the node position.

y

Y coordinate for the node position.

Details

If no x and y coordinates are provided, the function places the node in an arbitrary position, slightly different with each additional node, so that one can more easily replace the nodes afterwards using dag.move.

Value

A DAG with the new node added.

Author(s)

Lutz P Breitling <l.breitling@posteo.de>

See Also

Examples

dag1<-demo.dag1();
dag1a<-add.node(dag1);

dagR

R Functions for Directed Acyclic Graphs

v1.2.0
GPL-2
Authors
Lutz P Breitling
Initial release
2021-04-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.