Concatenate thousands of columns using UNITE

I have data frame (allgen) with nrow > 10k and ncol > 40K.
I would like to concatenate all columns in a single variable using UNITE. It works but it takes time (and I'm wondering if there is a better way to do it:

nrow(allgen) = 11824
ncol(allgen)= 42153

set first and last column

names(allgen)[2]-> start
names(allgen)[ncol(allgen)]-> end

system.time(allgen %>%
unite("S",start:end,sep='')-> test)

user system elapsed
192.35 0.03 193.01


This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.