R/list_transform.R

Defines functions list_transform

Documented in list_transform

#' Transform list of lists into data frame
#'
#' Converts list of lists, with all sub-lists having the same number of elements
#' into a data frame where each sub-list is a row and each element a column
#'
#' @param x a list of lists, with all sub-lists having the same length
#' @return a data frame where each sub-list is a row and each element of that
#'   sub-list is a column
#'
#' @seealso \code{list_transform} is a helper function used inside of
#'   \code{tf_parse} and \code{event_parse}


list_transform <- function(x) {
  df <- as.data.frame(t(as.data.frame(x, stringsAsFactors = FALSE)),
                      row.names = FALSE,
                      stringsAsFactors = FALSE)
  return(df)
}

Try the JumpeR package in your browser

Any scripts or data that you put into this service are public.

JumpeR documentation built on Nov. 17, 2021, 1:07 a.m.