I have a data frame that is 640 rows by 50,002 columns. I need to split the data columns 2:50001 into 5 equal groups. I have tried the split and sample commands but it gave an error.
Asked
Active
Viewed 43 times
1
-
1We can try `split.default(df1[-1], rep(1:4, each = 12500))` – akrun Aug 27 '18 at 18:39
-
One question my dimension ended up being 639 rows instead of 640 rows, would taking out the [-1] make the data go back to the orginal 640 rows – Allen Rahrooh Aug 27 '18 at 19:04
-
Please check if you data is data.frame. If that is the case, it should work fine – akrun Aug 27 '18 at 19:05
-
1@李哲源 yes that is correct column 1 and 50,002 are unused so not needed. so df1[,2:50002] gave me the data i needed – Allen Rahrooh Aug 27 '18 at 19:29