reshape alternating columns in less time and using less memory
问题 How can I do this reshape faster and so that it takes up less memory? My aim is to reshape a dataframe that is 500,000 rows by 500 columns with 4 Gb RAM. Here's a function that will make some reproducible data: make_example <- function(ndoc, ntop){ # doc numbers V1 = seq(1:ndoc) # filenames V2 <- list("vector", size = ndoc) for (i in 1:ndoc){ V2[i] <- paste(sample(c(rep(0:9,each=5),LETTERS,letters),5,replace=TRUE),collapse='') } # topic proportions tvals <- data.frame(matrix(runif(1:(ndoc