R bnlearn eval inside function
问题 I am using the bnlearn package in R to train a Bayesian network. I have troubles with the following code (slightly modified bnlearn example code): library(bnlearn) data(learning.test) fitted = bn.fit(hc(learning.test), learning.test) myfuncBN=function(){ var = names(learning.test) obs = 2 str = paste("(", names(learning.test)[-3], "=='", sapply(learning.test[obs,-3], as.character), "')", sep = "", collapse = " & ") str2 = paste("(", names(learning.test)[3], "=='", as.character(learning.test