R:创建一个带有tryCatch错误处理的txt文件
R: Create a txt file with the error handling of tryCatch
我想知道是否可以使用强制 tryCatch 执行 "error handling" 的 "error" 信息创建日志?
是为了能够获得潜在错误的可见性。我想避免打印。
谢谢!
这会起作用:
outputFile <-file("output.txt")
tryCatch({
--- your code ---
}, error = function(e) {
writeLines(as.character(e), outputFile)
})
-----------------------------
close(outputFile)
我想知道是否可以使用强制 tryCatch 执行 "error handling" 的 "error" 信息创建日志? 是为了能够获得潜在错误的可见性。我想避免打印。 谢谢!
这会起作用:
outputFile <-file("output.txt")
tryCatch({
--- your code ---
}, error = function(e) {
writeLines(as.character(e), outputFile)
})
-----------------------------
close(outputFile)