R/imExposomeSet-extract.R

#' @describeIn imExposomeSet Method to extract exposures for a single imputation
#' @param rid Number of the imputation to be extracted
setMethod(
    f = "extract",
    signature="imExposomeSet",
    definition = function(object, rid=-1, ...) {
        if(rid > -1) {
            if(rid > object@nimputation) {
                stop("Given 'rid' with imputation number is too large.")
            }
            tt <- object@assayData[object@assayData[ , 1] == rid, -(1:2), drop=FALSE]
            rownames(tt) <- object@assayData[object@assayData[ , 1] == rid, ".id"]
            return(tt)
        } else {
            stop("Invalid given 'rid'.")
        }
    }
)

Try the rexposome package in your browser

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

rexposome documentation built on March 13, 2021, 2:01 a.m.