#' Margonize
#'
#' "Interesting capitalization", I said.
#' "Yeah. I'm a big believer in random capitalization.
#' The rules of capitalization are so unfair to words in the middle.", Margo said.
#'
#' @param string The string you wish to margonize
#'
#' @return A margnoized string
#' @export
#'
#' @examples margonize("Sebastian is awesome!")
margonize <- function(string) {
string <- unlist(stringr::str_split(string, ""))
string <- lapply(string, function(char) {
if (runif(1) >= 0.5) {
char <- stringr::str_to_lower(char)
} else {
char <- stringr::str_to_upper(char)
}
return(char)
})
string <- do.call(c, string)
string <- stringr::str_c(string, collapse = "")
return(string)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.