R function for Bayesian Network Data Generation