R/get_sys_arch.R

Defines functions get_sys_arch

Documented in get_sys_arch

#' Retrieve Operating System and CPU Architecture
#'
#' This function retrieves the operating system (OS) name and the CPU architecture
#' of the current system. The output combines the OS and CPU architecture into
#' a single string in the format `"<OS>-<Architecture>"`.
#'
#' @return A character string indicating the operating system and CPU architecture,
#'   e.g., `"Darwin-x86_64"` or `"Linux-aarch64"`.
#'
#' @examples
#' # Retrieve the system architecture
#' condathis::get_sys_arch()
#' #> [1] "Darwin-x86_64"
#'
#' @export
get_sys_arch <- function() {
  os <- base::Sys.info()["sysname"]
  cpu_arch <- base::Sys.info()["machine"]
  return(base::paste0(os, "-", cpu_arch))
}

Try the condathis package in your browser

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

condathis documentation built on April 12, 2025, 2:01 a.m.