Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
使用该函数by时,有时我会有一个INDICES“中断”的数据子集(由参数确定)by(从技术上讲,它会中断FUN,而后者又会中断by)。
by
INDICES
FUN
有没有办法识别传递给的列表的“坏”值INDICES?(没有在列表上写一个显式循环)
你能举一个可重现的例子吗?
你可以尝试类似的东西,
customfun <- function(x)try(somefun(x)) byresult <- by(mydata, mydata$group, FUN=customfun) whichbad <- sapply(byresult, function(x)which(inherits(x, "try-error")))