You could use
lapply(lolz, `length<-`, max(lengths(lolz)))
# $a
# [1] 2 4 5 2 3 NA NA
#
# $b
# [1] 3 3 2 NA NA NA NA
#
# $c
# [1] 1 1 2 4 5 3 3
#
# $d
# [1] 1 2 3 1 NA NA NA
#
# $e
# [1] 5 4 2 2 NA NA NA
or
n <- max(lengths(lolz))
lapply(lolz, `length<-`, n)
More Related Contents:
- Gather multiple sets of columns
- Combine Multiple Columns Into Tidy Data [duplicate]
- R spreading multiple columns with tidyr [duplicate]
- dplyr summarise: Equivalent of “.drop=FALSE” to keep groups with zero length in output
- Using spread with duplicate identifiers for rows
- Proper idiom for adding zero count rows in tidyr/dplyr
- Reshape from long to wide and create columns with binary value
- adding default values to item x group pairs that don’t have a value (df %>% spread %>% gather seems strange)
- combine two data frames with all posible combinations
- Spread with duplicate identifiers (using tidyverse and %>%) [duplicate]
- Spreading a two column data frame with tidyr
- How to replace all NA in a dataframe using tidyr::replace_na? [duplicate]
- tidyverse – prefered way to turn a named vector into a data.frame/tibble
- Unlisting columns by groups
- Extract a dplyr tbl column as a vector
- Pass arguments to dplyr functions
- dplyr::select function clashes with MASS::select
- Sum across multiple columns with dplyr
- dplyr: nonstandard column names (white space, punctuation, starts with numbers)
- dplyr mutate/replace several columns on a subset of rows
- ignore NA in dplyr row sum
- dplyr on data.table, am I really using data.table?
- Set certain values to NA with dplyr
- tidyverse pivot_longer several sets of columns, but avoid intermediate mutate_wider steps [duplicate]
- Changing Million/Billion abbreviations into actual numbers? ie. 5.12M -> 5,120,000 [duplicate]
- Add a column with count of NAs and Mean
- Error with select function from dplyr
- Run a custom function on a data frame in R, by group
- Dealing with spaces and “weird” characters in column names with dplyr::rename()
- Filtering rows in R unexpectedly removes NAs when using subset or dplyr::filter