How do I ignore errors and continue processing list items?

前端 未结 2 2088
执笔经年
执笔经年 2021-02-14 12:19

I\'m running several hundred datasets through glm.nb using a wrapper function. Nothing fancy, I just pass on each list item via llply, then fit using <

2条回答
  •  心在旅途
    2021-02-14 12:41

    you can also use the failwith function in plyr. if f is the function you are passing to plyr, you can instead pass the function

    safef = failwith(NA, f)
    

    of course, you can replace NA with whatever return value you need when the function fails. this code is lifted directly from the examples for failwith.

提交回复
热议问题