My data consists of 3 factor variables each with 5 levels.
head(swiss_bn,n = 10)
A tibble: 10 × 3
arb_review blocks stops
<fctr> <fctr> <fctr>
1 exploratory [1,2] (0,2]
2 exploratory (3,5] (0,2]
3 exploratory (2,3] (0,2]
4 exploratory [1,2] (0,2]
5 exploratory [1,2] 0
6 exploratory (3,5] (2,4]
7 exploratory (3,5] (0,2]
8 exploratory (2,3] (0,2]
9 disoriented (5,23] (4,18]
10 disoriented (5,23] (4,18]
nlevels(swiss_bn$arb_review)
[1] 5
But When I run
library(bnlearn)
hc(swiss_bn)
I get the following error
Error in check.data(x) : variable arb_review must have at least two levels.