列出嵌套列表 R 中所有有错误消息的索引

List all the indices that has a error message in a nested list R

我正在并行使用 mclapply 到 运行 我的代码。下面是我的代码片段。当我设置 mc.preschedule = FALSE 时,它会存储错误并转到列表中的下一项。我想查看列表中的所有元素都有关联的错误消息。

OutputList = mclapply(Users.list,TestFunction,mc.cores = 25,mc.preschedule = FALSE)

以下是列表中某一项的错误消息。

`Jack`
[1] "Error in TestFunction(DF, x) : \n  Nodes in query cannot be found in the input graph.\n\n"
attr(,"class")
[1] "try-error"
attr(,"condition")
<simpleError in TestFunction(DF, x): Nodes in query cannot be found in the input graph.

有什么方法可以列出包含任何错误消息的所有索引?

which(mapply(inherits, OutputList, 'try-error'))