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

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -