Skip to contents

Generate a data.frame from list of vectors of uneven length

Usage

jmv_mixedLengthDF(list)

Arguments

list

Named list of character vectors to be used to generate data frame, with each vector ending up as a unique column.

Value

Data frame object with each vector from the input list as a column.

Note

For situations where you want to generate a data frame with columns that have different lengths. This works by calculating the maximum length of objects in the list, then padding the remaining list objects to fill with empty spaces so that a data frame can be created.

Examples

List <- list(A = sample(letters, 15), B = sample(letters, 20), C = sample(letters, 5))
output <- jmv_mixedLengthDF(List)