R/fileOpen.R

Defines functions fileOpen

fileOpen <- function(fname, ...) {
    con <- NULL
    if (!file.exists(fname)) {
        stop(sprintf("File %s does not appear to exist.", fname))
    }
    if (length(grep("\\.gz$", fname, perl = TRUE)) > 0) {
        con <- gzfile(fname, open = "rt")
    } else {
        con <- file(fname, "r")
    }
    return(con)
}
seandavi/GEOquery documentation built on Oct. 29, 2024, 1:24 p.m.