0 votes
1 view
in R Programming by (5.3k points)

I have a list of length 130,000 where each element is a character vector of length 110. I would like to convert this list to a matrix with dimension 1,430,000*10. How can I do it more efficiently?\ My code is :


for(i in 1:length(z)) {




1 Answer

0 votes
by (25.4k points)
edited by

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:

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers !