To convert a huge list of a vector to a matrix, you can use the unlist() function before creating a matrix as follows:
output <- matrix(unlist(z), ncol = 10, byrow = TRUE)
If you want to explore more in R programming then watch this R programming tutorial for beginner: