R/width.R

Defines functions console_width

Documented in console_width

#' Determine the width of the console
#'
#' It uses the `RSTUDIO_CONSOLE_WIDTH` environment variable, if set.
#' Otherwise it uses the `width` option. If this is not set either,
#' then 80 is used.
#'
#' @return Integer scalar, the console with, in number of characters.
#'
#' @export

console_width <- function() {
  width <- getOption(
    "cli.width",
    Sys.getenv(
      "RSTUDIO_CONSOLE_WIDTH",
      getOption("width", 80)
    )
  )
  as.integer(width)
}

Try the cliapp package in your browser

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

cliapp documentation built on Oct. 23, 2020, 6:36 p.m.