R/disown.R

Defines functions disown

Documented in disown

#' 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

}
danjamesadams/Dantools documentation built on Aug. 24, 2019, 6:15 p.m.