Nothing
#' Count characters or width of strings
#'
#' Uses stringi to ensure consistent character width calculations.
#'
#' @noRd
ncharw <- function(x, type = "width") {
if (requireNamespace("crayon", quietly = TRUE)) {
x <- crayon::strip_style(x)
}
# we use stringi throughout to keep the same concept of width
switch(type,
width = stringi::stri_width(x),
chars = stringi::stri_length(x),
stop("Unrecognized type in ncharw")
)
}
#' Replace elements with blanks where a condition is TRUE
#'
#' @noRd
blank_where <- function(text, cond) {
stopifnot(length(text) == length(cond))
text[cond] <- ""
text
}
#' Repeat strings elementwise
#'
#' @noRd
str_rep <- function(x, times) {
mapply(function(s, t) paste0(rep(s, t), collapse = ""), x, times)
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.