#' Reduce Object to a Nameless Vector.
#'
#' Takes a list or list-like object and generates a vector containing just the elements themselves. Can be called with 'apply' to cleanse matrices and data frames.
#' @keywords unname unlist disown
#' @export
#' @examples
#' mylist <- list('Alphabet' = LETTERS)
#'
#' mylist
#' $Alphabet
#' [1] "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z"
#' class(mylist)
#' [1] "list"
#'
#' disown(mylist)
#' [1] "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z"
#' class(disown(mylist))
#' "character"
disown <- function(object) {
object %>%
unlist %>%
unname %>%
as_vector
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.