is.discrete {MoTBFs}R Documentation

Check discreteness of a node

Description

This function allows to check whether a node is discrete or not

Usage

is.discrete(node, bn)

Arguments

node

A character (name of node) or numeric (index of node in the bn list) input.

bn

A list of lists obtained from MoTBFs_Learning.

Value

is.discrete returns TRUE or FALSE depending on whether the node is discrete 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)

## Learn BN
  bn <- MoTBFs_Learning(dag, data, POTENTIAL_TYPE = "MTE")

## Check wheter a node is discrete or not

  # Using its name
  is.discrete("D1", bn)
  
  # Using its index position
  is.discrete(3, bn)  

[Package MoTBFs version 1.4.1 Index]