0

I am currently workin on R.net application using c#.

I am new to R and i am not sure how to handle runtime exceptions in R language? I refered online material on R online but couldnt find useful.

Would try & catch help? or any loop? Please provide me steps.

Please help me. Thanks a lot in advance.

4

2 回答 2

0

该功能tryCatch是您正在寻找的。它是这样工作的:

result = tryCatch({
    expr
}, warning = function(w) {
    warning-handler-code
}, error = function(e) {
    error-handler-code
}, finally {
    cleanup-code
}

expr您想尝试运行的某个 R 表达式在哪里。

于 2012-09-28T15:14:43.453 回答
0

try catch finally 可能是您想要的。据我所知,r.net 中的错误处理与 c#/.net 中的错误处理相同。

一旦你发现错误,你所做的总是有争议的。Console.Log、EventLog、swallow 等

尝试 Catch 示例

于 2012-09-28T15:15:02.573 回答