#' @export
max_nchar <- function(x) {
# print(class(x))
# args <- formals(max_nchar)
# args$x <- x
# args$DEBUG <- DEBUG
# do.call(.max_nchar, args)
UseMethod(".max_nchar",x)
}
.max_nchar.vector <- function(x) {
# DEBUG = attr(x,"DEBUG")
#
# cat("\n--------------\n")
# print(x)
# print(max(nchar(x, type = "width"),na.rm=TRUE))
# cat("\n--------------\n")
# if(DEBUG) cat("\n .max_nchar VECTOR\n")
as.numeric(max(nchar(x, type = "width"),na.rm=TRUE))
}
.max_nchar.character <- function(x) {
# if(DEBUG) cat("\n .max_nchar CHARACTER\n")
.max_nchar.vector(x)
}
.max_nchar.numeric <- function(x) {
# if(DEBUG) cat("\n .max_nchar NUMERIC\n")
.max_nchar.vector(sprintf("%s",x))
}
.max_nchar.matrix <- function(x) {
# DEBUG = attr(x,"DEBUG")
# if(DEBUG) cat("\n .max_nchar MATRIX\n")
if (nrow(x) > 1) as.numeric(apply(x,2,function(x) max(nchar(x, type = "width"),na.rm=TRUE)))
else .max_nchar.vector(x)
}
.max_nchar.feR.fable <- function(x) {
# if(DEBUG) cat("\n .max_nchar FABLE\n")
.max_nchar.matrix(x)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.