R/with.datlist.R

Defines functions with.datlist

Documented in with.datlist

## File Name: with.datlist.R
## File Version: 0.09

# with function for datlist
# This function is copied and modified from with.imputationList (mitools package)
with.datlist <- function( data, expr, fun, ... )
{
    pf<-parent.frame()
    if (!is.null(match.call()$expr)){
        expr<-substitute(expr)
        results<-lapply(data, function(dataset) eval(expr, dataset, enclos=pf))
    } else {
        results<-lapply(data, fun,...)
    }
    if (all(sapply(results, inherits,  what="imputationResult"))){
        class(results)<-"imputationResultList"
        results$call<-sys.call(-1)
    } else {
        attr(results,"call")<-sys.call(-1)
    }
    return(results)
}

Try the miceadds package in your browser

Any scripts or data that you put into this service are public.

miceadds documentation built on May 29, 2024, 11:05 a.m.