[R] summary of a list

lauramorgana at bluewin.ch lauramorgana at bluewin.ch
Fri Feb 13 15:01:11 CET 2009


Thank you a lot!!! That was fantastic! It worked perfectly!!!
Laura

Hi Laura,

try using the functions try() and inherits() to "catch" any errors in the loop:


summaryList <- list()
for (i in 1:35)
{
    tempSummary <- try(summary(resultList[[i]]), silent = TRUE)
    if (inherits(tempSummary, "try-error"))
    {
        summaryList[[i]] <- NA
    } else {
        summaryList[[i]] <- tempSummary
    }
}


I hope you can make it work?! :-)

Christian




More information about the R-help mailing list