I am not familiar with tibble, I wanted to turn a list of lists with different depths into tibble, but I got the following errors using
> not.ok.list <- list(a = 'a', + b = paste0(rep('b', 4), c(1:4)), + c = paste0(rep('c', 5), c(1:5))) > as_tibble(not.ok.list) Error: Tibble columns must have compatible sizes. * Size 4: Column `b`. * Size 5: Column `c`. ℹ Only values of size one are recycled.
But it's ok with a list of lists with same depths (others are character or something):
> ok.list <- list(a = 'a', + b = paste0(rep('b', 4), c(1:4)), + c = paste0(rep('c', 4), c(1:4))) > as_tibble(ok.list) # A tibble: 4 x 3 a b c <chr> <chr> <chr> 1 a b1 c1 2 a b2 c2 3 a b3 c3 4 a b4 c4
I was wondering if there is a way to generate the tibble like:
# expected output for not.ok.list # A tibble: 1 x 3 a b c <chr> <list> <list> 1 a <list > <list >