r - using tryCatch in a loop for bnets -
i trying use trycatch loop through function know generate errors cannot syntax right error.
xcount <- 1 while(xcount < 11){ xvar <- as.character(x[,xcount]) yvar <- as.character(x[,xcount+1]) bn <- set.arc(bn, xvar, yvar) for(bn in 1:11){ trycatch({ plot(bn) score(bn, foo) error= function(e) print('error')})}
your trycatch
syntax off. use instead:
trycatch({ print(bn) }, error = function(e) { print('error') })
here great reference showing how use trycatch
in r.
Comments
Post a Comment