is.root: Root nodes

View source: R/Inference.R

is.rootR Documentation

Root nodes

Description

is.root checks whether a node has parents or not.

Usage

is.root(node, dag)

Arguments

node

A character string indicating the name of the node.

dag

An object of class "bn".

Value

is.root returns TRUE or FALSE depending on whether the node is root or not.

Examples


## Create a dataset
  # Continuous variables
  x <- rnorm(100)
  y <- rnorm(100)
  
  # Discrete variable
  z <- sample(letters[1:2],size = 100, replace = TRUE)
  
  data <- data.frame(C1 = x, C2 = y, D1 = z, stringsAsFactors = FALSE)
  
## Get DAG
  dag <- LearningHC(data)
  
## Check if a node is root
 is.root("C1", dag)

MoTBFs documentation built on April 18, 2022, 5:06 p.m.

Related to is.root in MoTBFs...