Thank you very much! Regards,
Lara Shane Baylis <shane.m.bay...@gmail.com> escreveu no dia terça, 26/02/2019 à(s) 01:53: > Hi Lara, > > You want to subset out 20% of the columns from a matrix, at random. Try: > > combinations <- combn(20,3) ## makes the 'all combinations' matrix > sample <- combinations[,sample(1:ncol(combinations), > floor(ncol(combinations)*0.2))] ## subsets out 20% of the columns from that > object. > ## Note that sample() samples without replacement, by default. > sample > > Hope that helps! > Shane > > On Tue, 26 Feb 2019 at 12:38, Lara Silva <lara.sfp.si...@gmail.com> wrote: > >> Hello, >> >> I want to select sets of combinations, but I do not want use all 1140 >> >> combn (20,3) >> >> choose (20,3) - total of 1140. >> >> [,1091] [,1092] [,1093] [,1094] [,1095] [,1096] [,1097] [,1098] >> [,1099] >> [,1100] >> [1,] 13 13 13 13 13 13 13 13 >> 13 13 >> [2,] 15 15 15 15 15 16 16 16 >> 16 17 >> [3,] 16 17 18 19 20 17 18 19 >> 20 18 >> [,1101] [,1102] [,1103] [,1104] [,1105] [,1106] [,1107] [,1108] >> [,1109] [,1110] >> [1,] 13 13 13 13 13 14 14 14 >> 14 14 >> [2,] 17 17 18 18 19 15 15 15 >> 15 15 >> [3,] 19 20 19 20 20 16 17 18 >> 19 20 >> [,1111] [,1112] [,1113] [,1114] [,1115] [,1116] [,1117] [,1118] >> [,1119] [,1120] >> [1,] 14 14 14 14 14 14 14 14 >> 14 14 >> [2,] 16 16 16 16 17 17 17 18 >> 18 19 >> [3,] 17 18 19 20 18 19 20 19 >> 20 20 >> [,1121] [,1122] [,1123] [,1124] [,1125] [,1126] [,1127] [,1128] >> [,1129] [,1130] >> [1,] 15 15 15 15 15 15 15 15 >> 15 15 >> [2,] 16 16 16 16 17 17 17 18 >> 18 19 >> [3,] 17 18 19 20 18 19 20 19 >> 20 20 >> [,1131] [,1132] [,1133] [,1134] [,1135] [,1136] [,1137] [,1138] >> [,1139] [,1140] >> [1,] 16 16 16 16 16 16 17 17 >> 17 18 >> [2,] 17 17 17 18 18 19 18 18 >> 19 19 >> [3,] 18 19 20 19 20 20 19 20 >> 20 20 >> >> >> If it possible to select 20% of this combinations (sets)? >> It is important to generate a random sample ... >> >> Example >> >> 15 1 8 ... >> 16 7 20.... >> 17 20 13... >> >> Any advice? >> >> Thanks, >> >> Lara >> >> [[alternative HTML version deleted]] >> >> _______________________________________________ >> R-sig-ecology mailing list >> R-sig-ecology@r-project.org >> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology >> > [[alternative HTML version deleted]] _______________________________________________ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology