I have something like this:

```
x1 <- list(1,2,3,4,5)
x2 <- list(1,4,7,8)
x3 <- list(5,6)
x4 <- list(9,0,0,5,6,7)
myList <- list(x1, x2, x3, x4)

```

I want to turn the list, 'myList' into a data frame where each row is a separate list, so row 1 only contains values for x1, row 2 only contains values for x2 and so on. However when I run a code like this:

```
df <- data.frame(matrix(unlist(myList), nrow=length(myList), byrow = T))

```

It doesn't differentiate between lists and splits the lists so that if fits evenly. The examples that I saw online all show how to do it in a way that "empty" cells of the data frame are filled with N/A. However I want each cell to have a value inside it. How can I make it so that it makes a data frame of size (# of lists x length of largest list) and the smaller lists repeat their last value until they are of equal length as the largest list. So, with the above example something like this:

```
X1 X2 X3 X4 X5 X6
 1  2  3  4  5  5
 1  4  7  8  8  8
 5  6  6  6  6  6
 9  0  0  5  6  7

```