Learn R Programming

simcausal (version 0.5.7)

N: Subsetting/Indexing DAG Nodes

Description

Subsetting/Indexing DAG Nodes

Usage

N(DAG)

Value

returns a list of nodes that can be indexed as a typical named list "[[]]".

Arguments

DAG

A DAG object that was defined using functions node and set.DAG.

Examples

Run this code

D <- DAG.empty()
D <- D + node(name="W1", distr="rbern", prob=plogis(-0.5))
D <- D + node(name="W2", distr="rbern", prob=plogis(-0.5 + 0.5*W1))
D <- set.DAG(D)
#Returns all nodes from DAG D
N(D)
#Returns node W1 from DAG D
N(D)["W1"]

Run the code above in your browser using DataLab