R/AAA_shorten.R

Defines functions shorten

# shorten a string so it fits in a line.
shorten <- function(x, n, ellipsis = "...") {
  if (n < 0L)
    n <- getOption("width") + n - nchar(ellipsis)
  
  if (nchar(x) > n)
    x <- paste0(substr(x, 1, n), ellipsis)
  
  x
}

Try the pomdp package in your browser

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

pomdp documentation built on May 29, 2024, 2:04 a.m.