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{swim_parse}, \code{swim_parse_ISL}, \code{event_parse} and
#'   \code{event_parse_ISL}


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

Try the SwimmeR package in your browser

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

SwimmeR documentation built on March 31, 2023, 8:27 p.m.