R/utils.R

Defines functions is_windows is_unix is_osx is_linux is_ubuntu

# checking os functions, thanks to r-tensorflow

is_windows <- function() {
    identical(.Platform$OS.type, "windows")
}

is_unix <- function() {
    identical(.Platform$OS.type, "unix")
}

is_osx <- function() {
    Sys.info()["sysname"] == "Darwin"
}

is_linux <- function() {
    identical(tolower(Sys.info()[["sysname"]]), "linux")
}

is_ubuntu <- function() {
    if (is_unix() && file.exists("/etc/lsb-release")) {
        lsbrelease <- readLines("/etc/lsb-release")
        any(grepl("Ubuntu", lsbrelease))
    } else {
        FALSE
    }
}

Try the spacyr package in your browser

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

spacyr documentation built on March 26, 2020, 5:25 p.m.