Given some samples it distribute them in several batches, trying to have equal number of samples per batch. It can handle both numeric and categorical data.
Arguments
- pheno
Data.frame with the sample information.
- size_subset
Numeric value of the number of sample per batch.
- omit
Name of the columns of the
pheno
that will be omitted.- iterations
Numeric value of iterations that will be performed.
- name
A character used to name the subsets, either a single one or a vector the same size as
n
.
See also
The evaluate_*
functions and create_subset()
.
Examples
data(survey, package = "MASS")
index <- design(survey[, c("Sex", "Smoke", "Age")], size_subset = 50,
iterations = 10)
#> Warning: There might be some problems with the data use check_data().
index
#> $SubSet1
#> [1] 16 19 23 27 28 35 37 42 54 64 74 86 90 91 92 94 96 100 106
#> [20] 116 119 120 122 124 127 128 136 137 139 154 156 159 178 181 202 204 205 207
#> [39] 208 209 212 218 219 222 223 226 229 237
#>
#> $SubSet2
#> [1] 11 13 24 26 34 45 47 58 59 69 75 83 84 88 89 97 103 109 110
#> [20] 118 129 130 142 145 146 149 152 153 160 162 166 171 175 179 184 187 191 193
#> [39] 194 197 199 200 210 220 228 231 234 235
#>
#> $SubSet3
#> [1] 1 9 12 14 15 17 20 21 29 30 31 38 43 44 46 48 52 53 55
#> [20] 60 67 76 79 80 82 95 98 107 112 133 138 144 147 150 151 157 169 174
#> [39] 176 188 190 198 206 216 221 227 236
#>
#> $SubSet4
#> [1] 2 8 10 18 22 25 32 33 36 39 40 41 49 51 56 61 62 63 68
#> [20] 72 73 93 99 101 104 108 113 126 131 132 134 140 141 143 148 163 164 165
#> [39] 167 180 182 186 189 201 203 224 232
#>
#> $SubSet5
#> [1] 3 4 5 6 7 50 57 65 66 70 71 77 78 81 85 87 102 105 111
#> [20] 114 115 117 121 123 125 135 155 158 161 168 170 172 173 177 183 185 192 195
#> [39] 196 211 213 214 215 217 225 230 233
#>