R/methods-typeof.R

#' @title The type of a file array (extended)
#' @param x any file array
#' @return A character string. The possible values are \code{"double"},
#' \code{"integer"}, \code{"logical"}, and \code{"raw"}
#' @export
setGeneric("typeof")

#' @rdname typeof
setMethod('typeof', signature(x = "FileArray"), function(x){
    if(!x$valid()){
        stop("Invalid file array")
    }
    x$type()
})

#' @rdname typeof
setMethod('typeof', signature(x = "FileArrayProxy"), function(x){
    if(!x$valid()){
        stop("Invalid file array")
    }
    if( length(x$.ops) ) {
        final_op <- x$.ops[[length(x$.ops)]]
        return( final_op$output_type )
    } else {
        x$type()
    }
})

Try the filearray package in your browser

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

filearray documentation built on July 9, 2023, 5:53 p.m.