#' Short Head
#'
#' Returns a more limited head (~10 col) of the object.
#' @param x Vector, matrix, dataframe, or list.
#' @param n_col Vector; Which columns to return. Defaults to 10.
#' @param returnDim Logical; Return dimensions of data? Defaults to TRUE
#' @export
#' @return Head of x.
shead <- function (x, n_col = 1:10, returnDim = TRUE)
{
if (is.null(dim(x))) {
if (returnDim)
cat(paste0("(length: ", length(x), ")", "\n"))
print(head(x))
}
if (!(is.null(dim(x)))) {
if (ncol(x) < 10) {
if (returnDim)
cat(paste0("[", nrow(x), ",", ncol(x), "]", "\n"))
print(head(x))
}
else {
if (returnDim)
cat(paste0("[", nrow(x), ",", ncol(x), "]", "\n"))
print(head(x[, n_col]))
}
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.