R/wpGetOS.R

# Authors: Maksym Bondarenko mb4@soton.ac.uk
# Date :  October 2017
# Version 0.1
#
#' wpGetOS function will return a string with OS
#' of the system
#' Tested on Windows 10

#' @rdname wpGetOS
#' @return string
wpGetOS <- function(){

  sysinf <- Sys.info()

  if (!is.null(sysinf)){

        OS <- tolower(sysinf['sysname'])

        if(OS == 'windows'){

            return('windows')

        } else if (OS == 'darwin') {

            return('osx')

        } else if (OS == 'linux') {

            return('linux')

        }

  } else { ## other OS
    OS <- .Platform$OS.type
    if (grepl("^darwin", R.version$os))
      return('osx')
    if (grepl("linux-gnu", R.version$os))
      return('linux')
  }

}
worldpopglobal/wpUtilities documentation built on May 29, 2019, 11:58 a.m.