R/get_os.R

Defines functions get_os

Documented in get_os

#' Get OS imformation.
#' @return \item{os}{Returns a string indicating the operating systems, 'windows', 'linux', or 'osx'.}
#' @examples
#' get_os()
#' @seealso Function \code{\link{which_os}}
#' @export

get_os <- function(){
  sysinf <- Sys.info()
  if (!is.null(sysinf)){
    os <- sysinf['sysname']
    if (os == 'Darwin')
      os <- "osx"
  } else { ## mystery machine
    os <- .Platform$OS.type
    if (grepl("^darwin", R.version$os))
      os <- "osx"
    if (grepl("linux-gnu", R.version$os))
      os <- "linux"
  }
  tolower(os)
  return(os)
}
kang-yu/lazyu documentation built on May 30, 2019, 11:42 a.m.