R/checkTargetClassOfElements.R

Defines functions allElementsAreOfClass checkTargetClassOfElements

checkTargetClassOfElements<-function(l,targetClassName){
    if(!allElementsAreOfClass(l,targetClassName)){
        stop(
            paste(
                'The list elements have to be of type:'
                ,targetClassName
            )
        )
    }
}
allElementsAreOfClass<-function(object,targetClassName){
        result=all(as.logical(lapply(object,function(el){
                   res<-is(el,targetClassName)
                   res
        })))
        result
}

Try the SoilR package in your browser

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

SoilR documentation built on Oct. 13, 2023, 5:06 p.m.