Usage of accumarray function (pracma package)

I need to use R for my study and I already developed a code in MATLAB environment involving ACCUMARRAY function. I obtain an error in R because I think R can't deal with sparse data (I need)

I wrote the code in R but, when it comes to accumarray function in R (package pracma) I keep on getting an error message

Here is the code I used in MATLAB

'''
data_OK = changem(data,[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400
],[1 1.1 1.2 1.3 2 2.1 2.2 2.3 3 3.1 3.2 3.3 4 4.1 4.2 4.3 5 5.1 5.2 5.3 6 6.1 6.2 6.3 7 7.1 7.2 7.3 8 8.1 8.2 8.3 9 9.1 9.2 9.3 10 10.1 10.2 10.3 11 11.1 11.2 11.3 12 12.1 12.2 12.3 13 13.1 13.2 13.3 14 14.1 14.2 14.3 15 15.1 15.2 15.3 16 16.1 16.2 16.3 17 17.1 17.2 17.3 18 18.1 18.2 18.3 19 19.1 19.2 19.3 20 20.1 20.2 20.3 21 21.1 21.2 21.3 22 22.1 22.2 22.3 23 23.1 23.2 23.3 24 24.1 24.2 24.3 25 25.1 25.2 25.3 26 26.1 26.2 26.3 27 27.1 27.2 27.3 28 28.1 28.2 28.3 29 29.1 29.2 29.3 30 30.1 30.2 30.3 31 31.1 31.2 31.3 32 32.1 32.2 32.3 33 33.1 33.2 33.3 34 34.1 34.2 34.3 35 35.1 35.2 35.3 36 36.1 36.2 36.3 37 37.1 37.2 37.3 38 38.1 38.2 38.3 39 39.1 39.2 39.3 40 40.1 40.2 40.3 41 41.1 41.2 41.3 42 42.1 42.2 42.3 43 43.1 43.2 43.3 44 44.1 44.2 44.3 45 45.1 45.2 45.3 46 46.1 46.2 46.3 47 47.1 47.2 47.3 48 48.1 48.2 48.3 49 49.1 49.2 49.3 50 50.1 50.2 50.3 51 51.1 51.2 51.3 52 52.1 52.2 52.3 53 53.1 53.2 53.3 54 54.1 54.2 54.3 55 55.1 55.2 55.3 56 56.1 56.2 56.3 57 57.1 57.2 57.3 58 58.1 58.2 58.3 59 59.1 59.2 59.3 60 60.1 60.2 60.3 61 61.1 61.2 61.3 62 62.1 62.2 62.3 63 63.1 63.2 63.3 64 64.1 64.2 64.3 65 65.1 65.2 65.3 66 66.1 66.2 66.3 67 67.1 67.2 67.3 68 68.1 68.2 68.3 69 69.1 69.2 69.3 70 70.1 70.2 70.3 71 71.1 71.2 71.3 72 72.1 72.2 72.3 73 73.1 73.2 73.3 74 74.1 74.2 74.3 75 75.1 75.2 75.3 76 76.1 76.2 76.3 77 77.1 77.2 77.3 78 78.1 78.2 78.3 79 79.1 79.2 79.3 80 80.1 80.2 80.3 81 81.1 81.2 81.3 82 82.1 82.2 82.3 83 83.1 83.2 83.3 84 84.1 84.2 84.3 85 85.1 85.2 85.3 86 86.1 86.2 86.3 87 87.1 87.2 87.3 88 88.1 88.2 88.3 89 89.1 89.2 89.3 90 90.1 90.2 90.3 91 91.1 91.2 91.3 92 92.1 92.2 92.3 93 93.1 93.2 93.3 94 94.1 94.2 94.3 95 95.1 95.2 95.3 96 96.1 96.2 96.3 97 97.1 97.2 97.3 98 98.1 98.2 98.3 99 99.1 99.2 99.3 100 100.1 100.2 100.3]);
s = size(data_OK);
[ii,~] = ndgrid(1:s(1),1:s(2));
data_OK2 = accumarray([ii(:),data_OK(:)],1,[s(1),400])
'''
and here is the code I developed for R (limited up to 50 since it is sufficient)

'''
library(pracma)
library(car)
data=recode(data,"'1'=1; '1.1'=2; '1.2'=3; '1.3'=4; '2'=5; '2.1'=6; '2.2'=7; '2.3'=8; '3'=9; '3.1'=10; '3.2'=11; '3.3'=12; '4'=13; '4.1'=14; '4.2'=15; '4.3'=16; '5'=17; '5.1'=18; '5.2'=19; '5.3'=20; '6'=21; '6.1'=22; '6.2'=23; '6.3'=24; '7'=25; '7.1'=26; '7.2'=27; '7.3'=28; '8'=29; '8.1'=30; '8.2'=31; '8.3'=32; '9'=33; '9.1'=34; '9.2'=35; '9.3'=36; '10'=37; '10.1'=38; '10.2'=39; '10.3'=40; '11'=41; '11.1'=42; '11.2'=43; '11.3'=44; '12'=45; '12.1'=46; '12.2'=47; '12.3'=48; '13'=49; '13.1'=50; '13.2'=51; '13.3'=52; '14'=53; '14.1'=54; '14.2'=55; '14.3'=56; '15'=57; '15.1'=58; '15.2'=59; '15.3'=60; '16'=61; '16.1'=62; '16.2'=63; '16.3'=64; '17'=65; '17.1'=66; '17.2'=67; '17.3'=68; '18'=69; '18.1'=70; '18.2'=71; '18.3'=72; '19'=73; '19.1'=74; '19.2'=75; '19.3'=76; '20'=77; '20.1'=78; '20.2'=79; '20.3'=80; '21'=81; '21.1'=82; '21.2'=83; '21.3'=84; '22'=85; '22.1'=86; '22.2'=87; '22.3'=88; '23'=89; '23.1'=90; '23.2'=91; '23.3'=92; '24'=93; '24.1'=94; '24.2'=95; '24.3'=96; '25'=97; '25.1'=98; '25.2'=99; '25.3'=100; '26'=101; '26.1'=102; '26.2'=103; '26.3'=104; '27'=105; '27.1'=106; '27.2'=107; '27.3'=108; '28'=109; '28.1'=110; '28.2'=111; '28.3'=112; '29'=113; '29.1'=114; '29.2'=115; '29.3'=116; '30'=117; '30.1'=118; '30.2'=119; '30.3'=120; '31'=121; '31.1'=122; '31.2'=123; '31.3'=124; '32'=125; '32.1'=126; '32.2'=127; '32.3'=128; '33'=129; '33.1'=130; '33.2'=131; '33.3'=132; '34'=133; '34.1'=134; '34.2'=135; '34.3'=136; '35'=137; '35.1'=138; '35.2'=139; '35.3'=140; '36'=141; '36.1'=142; '36.2'=143; '36.3'=144; '37'=145; '37.1'=146; '37.2'=147; '37.3'=148; '38'=149; '38.1'=150; '38.2'=151; '38.3'=152; '39'=153; '39.1'=154; '39.2'=155; '39.3'=156; '40'=157; '40.1'=158; '40.2'=159; '40.3'=160; '41'=161; '41.1'=162; '41.2'=163; '41.3'=164; '42'=165; '42.1'=166; '42.2'=167; '42.3'=168; '43'=169; '43.1'=170; '43.2'=171; '43.3'=172; '44'=173; '44.1'=174; '44.2'=175; '44.3'=176; '45'=177; '45.1'=178; '45.2'=179; '45.3'=180; '46'=181; '46.1'=182; '46.2'=183; '46.3'=184; '47'=185; '47.1'=186; '47.2'=187; '47.3'=188; '48'=189; '48.1'=190; '48.2'=191; '48.3'=192; '49'=193; '49.1'=194; '49.2'=195; '49.3'=196; '50'=197;
")
data<-matrix(data,ncol = 2)
s=dim(data)
ii<-cbind(c(seq(1, s[1], by=1)),c(seq(1, s[1], by=1)))
a=cbind(c(ii[,]),c(data[,]))
b=0:1
c=nrow(x)
c=c(s[1],c)
c
pr=accumarray(a,b,c)
'''
I expect a matrix full of zeros, with 1 and 2 sparse all over the dataset, but I keep on obtaining the following error, that is probably related to a wrong syntax in the R accumarray function.

Error in accumarray(a, b, c) :
Length of 'vals' must not be smaller than no. of rows of 'subs'.

Hi!

I can't run your code, as your code starts with data = recode(data, ...), and I don't have the original data. Can you please share a minimal and reproducible example, alongwith an expected output and explanation of what you're trying to do?

Also, I guess you don't need to type so many things. paste and each argument of rep should be useful here. Maybe, you can use something like paste0("'",rep(1:100,4),"'=",1:400,collapse=";")?

It'll be very helpful if you please provide us a reprex, and the following guide is very helpful regarding that:

1 Like

Dear Yarnabrina,
thank you for your kind reply. I show here two examples, the first showing the input file, the second showing the dataset I'd like to obtain (involving 197 possible values for the input data. Values can also be repeated in the two original variables for the same subject).

input_data<-data.frame(
                             DCFT.1 = c(45L, 45L, 45L, 49L, 49L),
                             DCFT.2 = c(49L, 45L, 53L, 49L, 49L),
                            subject = as.factor(c("A1", "A2", "A3", "A4", "A5"))
                       )
output_data<-data.frame(
      DCFT.1 = c(0L, 0L, 0L, 0L, 0L),
      DCFT.2 = c(0L, 0L, 0L, 0L, 0L),
      DCFT.3 = c(0L, 0L, 0L, 0L, 0L),
      DCFT.4 = c(0L, 0L, 0L, 0L, 0L),
      DCFT.5 = c(0L, 0L, 0L, 0L, 0L),
      DCFT.6 = c(0L, 0L, 0L, 0L, 0L),
      DCFT.7 = c(0L, 0L, 0L, 0L, 0L),
      DCFT.8 = c(0L, 0L, 0L, 0L, 0L),
      DCFT.9 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.10 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.11 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.12 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.13 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.14 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.15 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.16 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.17 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.18 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.19 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.20 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.21 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.22 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.23 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.24 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.25 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.26 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.27 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.28 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.29 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.30 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.31 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.32 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.33 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.34 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.35 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.36 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.37 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.38 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.39 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.40 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.41 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.42 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.43 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.44 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.45 = c(1L, 2L, 1L, 0L, 0L),
     DCFT.46 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.47 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.48 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.49 = c(1L, 0L, 0L, 2L, 2L),
     DCFT.50 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.51 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.52 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.53 = c(0L, 0L, 1L, 0L, 0L),
     DCFT.54 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.55 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.56 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.57 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.58 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.59 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.60 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.61 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.62 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.63 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.64 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.65 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.66 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.67 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.68 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.69 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.70 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.71 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.72 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.73 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.74 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.75 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.76 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.77 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.78 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.79 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.80 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.81 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.82 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.83 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.84 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.85 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.86 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.87 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.88 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.89 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.90 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.91 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.92 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.93 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.94 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.95 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.96 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.97 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.98 = c(0L, 0L, 0L, 0L, 0L),
     DCFT.99 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.100 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.101 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.102 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.103 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.104 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.105 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.106 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.107 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.108 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.109 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.110 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.111 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.112 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.113 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.114 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.115 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.116 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.117 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.118 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.119 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.120 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.121 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.122 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.123 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.124 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.125 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.126 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.127 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.128 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.129 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.130 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.131 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.132 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.133 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.134 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.135 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.136 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.137 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.138 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.139 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.140 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.141 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.142 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.143 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.144 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.145 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.146 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.147 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.148 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.149 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.150 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.151 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.152 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.153 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.154 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.155 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.156 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.157 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.158 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.159 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.160 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.161 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.162 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.163 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.164 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.165 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.166 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.167 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.168 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.169 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.170 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.171 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.172 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.173 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.174 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.175 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.176 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.177 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.178 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.179 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.180 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.181 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.182 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.183 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.184 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.185 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.186 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.187 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.188 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.189 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.190 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.191 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.192 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.193 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.194 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.195 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.196 = c(0L, 0L, 0L, 0L, 0L),
    DCFT.197 = c(0L, 0L, 0L, 0L, 0L),
     subject = as.factor(c("campione_1", "campione_2", "campione_3",
                           "campione_4", "campione_5"))
)

I'd be very grateful if you could attend to this matter. Thank you very much for your help

I do not know MATLAB, and hence requested for the explanation. Since you haven't provided any, my attempt is going to be a result of my vague idea from SO threads and pracma documentation. Anyway, I didn't follow how did you get 197.

The result of following matches the expected output, but I'm sure it can be made better.

input_dataset <- data.frame(DCFT.1 = c(45L, 45L, 45L, 49L, 49L),
                            DCFT.2 = c(49L, 45L, 53L, 49L, 49L),
                            subject = c("A1", "A2", "A3", "A4", "A5")) # as.factor not required, because of default behaviour of `stringsAsFactors`

expected_output <- data.frame(DCFT.1 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.2 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.3 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.4 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.5 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.6 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.7 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.8 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.9 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.10 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.11 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.12 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.13 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.14 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.15 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.16 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.17 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.18 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.19 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.20 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.21 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.22 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.23 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.24 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.25 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.26 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.27 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.28 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.29 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.30 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.31 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.32 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.33 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.34 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.35 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.36 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.37 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.38 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.39 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.40 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.41 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.42 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.43 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.44 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.45 = c(1L, 2L, 1L, 0L, 0L),
                              DCFT.46 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.47 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.48 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.49 = c(1L, 0L, 0L, 2L, 2L),
                              DCFT.50 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.51 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.52 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.53 = c(0L, 0L, 1L, 0L, 0L),
                              DCFT.54 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.55 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.56 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.57 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.58 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.59 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.60 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.61 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.62 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.63 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.64 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.65 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.66 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.67 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.68 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.69 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.70 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.71 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.72 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.73 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.74 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.75 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.76 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.77 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.78 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.79 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.80 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.81 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.82 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.83 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.84 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.85 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.86 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.87 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.88 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.89 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.90 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.91 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.92 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.93 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.94 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.95 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.96 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.97 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.98 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.99 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.100 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.101 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.102 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.103 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.104 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.105 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.106 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.107 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.108 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.109 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.110 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.111 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.112 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.113 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.114 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.115 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.116 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.117 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.118 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.119 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.120 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.121 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.122 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.123 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.124 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.125 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.126 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.127 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.128 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.129 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.130 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.131 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.132 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.133 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.134 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.135 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.136 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.137 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.138 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.139 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.140 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.141 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.142 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.143 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.144 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.145 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.146 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.147 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.148 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.149 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.150 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.151 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.152 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.153 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.154 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.155 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.156 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.157 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.158 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.159 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.160 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.161 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.162 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.163 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.164 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.165 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.166 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.167 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.168 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.169 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.170 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.171 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.172 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.173 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.174 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.175 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.176 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.177 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.178 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.179 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.180 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.181 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.182 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.183 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.184 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.185 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.186 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.187 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.188 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.189 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.190 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.191 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.192 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.193 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.194 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.195 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.196 = c(0L, 0L, 0L, 0L, 0L),
                              DCFT.197 = c(0L, 0L, 0L, 0L, 0L),
                              subject = c("campione_1", "campione_2", "campione_3", "campione_4", "campione_5"))

required_subs <- cbind(rep(x = 1:nrow(input_dataset),
                           times = 2),
                       c(input_dataset$DCFT.1, input_dataset$DCFT.2))
required_vals <- rep(x = 1,
                     times = nrow(x = required_subs))
required_sz <- c(nrow(x = input_dataset), 197)

result <- cbind(as.data.frame(x = pracma::accumarray(subs = required_subs,
                                                     val = required_vals,
                                                     sz = required_sz)),
                paste("campione", 1:5, sep = "_"))
names(x = result) <- c(paste("DCFT", 1:197, sep = "."), "subject")

all.equal(target = expected_output,
          current = result) # will lead to TRUE
2 Likes

Dear @Yarnabrina,
here is the updated input of the data:

data.frame(
        DCFT = c(75L, 22L, 19L, 80L, 45L),
      DCFT.1 = c(95L, 37L, 45L, 81L, 45L),
        XPRG = c(11L, 70L, 19L, 1L, 15L),
      XPRG.1 = c(12L, 75L, 30L, 1L, 19L),
        TROK = c(15L, 11L, 7L, 12L, 5L),
      TROK.1 = c(19L, 11L, 9L, 13L, 6L),
     subject = as.factor(c("A1", "A2", "A3", "A4", "A5"))
)

and then I'll post the output, too

Here's the output for the first 2 subjects:

output<-data.frame(
                                    V1 = c(0, 0),
                                    V2 = c(0, 0),
                                    V3 = c(0, 0),
                                    V4 = c(0, 0),
                                    V5 = c(0, 0),
                                    V6 = c(0, 0),
                                    V7 = c(0, 0),
                                    V8 = c(0, 0),
                                    V9 = c(0, 0),
                                   V10 = c(0, 0),
                                   V11 = c(0, 0),
                                   V12 = c(0, 0),
                                   V13 = c(0, 0),
                                   V14 = c(0, 0),
                                   V15 = c(0, 0),
                                   V16 = c(0, 0),
                                   V17 = c(0, 0),
                                   V18 = c(0, 0),
                                   V19 = c(0, 0),
                                   V20 = c(0, 0),
                                   V21 = c(0, 0),
                                   V22 = c(0, 0),
                                   V23 = c(0, 0),
                                   V24 = c(0, 0),
                                   V25 = c(0, 0),
                                   V26 = c(0, 0),
                                   V27 = c(0, 0),
                                   V28 = c(0, 0),
                                   V29 = c(0, 0),
                                   V30 = c(0, 0),
                                   V31 = c(0, 0),
                                   V32 = c(0, 0),
                                   V33 = c(0, 0),
                                   V34 = c(0, 0),
                                   V35 = c(0, 0),
                                   V36 = c(0, 0),
                                   V37 = c(0, 2),
                                   V38 = c(0, 0),
                                   V39 = c(0, 0),
                                   V40 = c(0, 0),
                                   V41 = c(0, 0),
                                   V42 = c(0, 0),
                                   V43 = c(0, 0),
                                   V44 = c(0, 0),
                                   V45 = c(0, 0),
                                   V46 = c(0, 0),
                                   V47 = c(0, 0),
                                   V48 = c(0, 0),
                                   V49 = c(0, 0),
                                   V50 = c(0, 0),
                                   V51 = c(0, 0),
                                   V52 = c(0, 0),
                                   V53 = c(0, 0),
                                   V54 = c(0, 0),
                                   V55 = c(0, 0),
                                   V56 = c(0, 0),
                                   V57 = c(0, 0),
                                   V58 = c(0, 0),
                                   V59 = c(0, 0),
                                   V60 = c(0, 0),
                                   V61 = c(0, 0),
                                   V62 = c(0, 0),
                                   V63 = c(0, 0),
                                   V64 = c(0, 0),
                                   V65 = c(0, 0),
                                   V66 = c(0, 0),
                                   V67 = c(0, 0),
                                   V68 = c(0, 0),
                                   V69 = c(0, 0),
                                   V70 = c(0, 0),
                                   V71 = c(0, 0),
                                   V72 = c(0, 0),
                                   V73 = c(0, 0),
                                   V74 = c(0, 0),
                                   V75 = c(0, 0),
                                   V76 = c(0, 0),
                                   V77 = c(0, 0),
                                   V78 = c(0, 0),
                                   V79 = c(0, 0),
                                   V80 = c(0, 0),
                                   V81 = c(0, 0),
                                   V82 = c(0, 0),
                                   V83 = c(0, 0),
                                   V84 = c(0, 0),
                                   V85 = c(0, 0),
                                   V86 = c(0, 0),
                                   V87 = c(0, 0),
                                   V88 = c(0, 0),
                                   V89 = c(0, 0),
                                   V90 = c(0, 0),
                                   V91 = c(0, 0),
                                   V92 = c(0, 0),
                                   V93 = c(0, 0),
                                   V94 = c(0, 0),
                                   V95 = c(2, 0),
                                   V96 = c(0, 0),
                                   V97 = c(0, 0),
                                   V98 = c(0, 0),
                                   V99 = c(0, 0),
                                  V100 = c(0, 0),
                                  V101 = c(0, 0),
                                  V102 = c(0, 0),
                                  V103 = c(0, 0),
                                  V104 = c(0, 0),
                                  V105 = c(0, 0),
                                  V106 = c(0, 0),
                                  V107 = c(0, 0),
                                  V108 = c(0, 0),
                                  V109 = c(0, 0),
                                  V110 = c(0, 0),
                                  V111 = c(0, 0),
                                  V112 = c(0, 0),
                                  V113 = c(0, 0),
                                  V114 = c(0, 0),
                                  V115 = c(0, 0),
                                  V116 = c(0, 0),
                                  V117 = c(0, 0),
                                  V118 = c(0, 0),
                                  V119 = c(0, 0),
                                  V120 = c(0, 0),
                                  V121 = c(0, 0),
                                  V122 = c(0, 0),
                                  V123 = c(0, 0),
                                  V124 = c(0, 0),
                                  V125 = c(0, 0),
                                  V126 = c(0, 0),
                                  V127 = c(0, 0),
                                  V128 = c(0, 0),
                                  V129 = c(0, 0),
                                  V130 = c(0, 0),
                                  V131 = c(0, 0),
                                  V132 = c(0, 0),
                                  V133 = c(0, 0),
                                  V134 = c(0, 0),
                                  V135 = c(0, 0),
                                  V136 = c(0, 0),
                                  V137 = c(0, 0),
                                  V138 = c(0, 0),
                                  V139 = c(0, 0),
                                  V140 = c(0, 0),
                                  V141 = c(0, 0),
                                  V142 = c(0, 0),
                                  V143 = c(0, 0),
                                  V144 = c(0, 0),
                                  V145 = c(0, 0),
                                  V146 = c(0, 0),
                                  V147 = c(0, 0),
                                  V148 = c(0, 0),
                                  V149 = c(0, 0),
                                  V150 = c(0, 0),
                                  V151 = c(0, 0),
                                  V152 = c(0, 0),
                                  V153 = c(0, 0),
                                  V154 = c(0, 0),
                                  V155 = c(0, 0),
                                  V156 = c(0, 0),
                                  V157 = c(0, 0),
                                  V158 = c(0, 0),
                                  V159 = c(0, 0),
                                  V160 = c(0, 0),
                                  V161 = c(0, 0),
                                  V162 = c(0, 0),
                                  V163 = c(0, 0),
                                  V164 = c(0, 0),
                                  V165 = c(0, 0),
                                  V166 = c(0, 0),
                                  V167 = c(0, 0),
                                  V168 = c(0, 0),
                                  V169 = c(0, 0),
                                  V170 = c(0, 0),
                                  V171 = c(0, 0),
                                  V172 = c(0, 0),
                                  V173 = c(0, 0),
                                  V174 = c(0, 0),
                                  V175 = c(0, 0),
                                  V176 = c(0, 0),
                                  V177 = c(0, 0),
                                  V178 = c(0, 0),
                                  V179 = c(0, 0),
                                  V180 = c(0, 0),
                                  V181 = c(0, 0),
                                  V182 = c(0, 0),
                                  V183 = c(0, 0),
                                  V184 = c(0, 0),
                                  V185 = c(0, 0),
                                  V186 = c(0, 0),
                                  V187 = c(0, 0),
                                  V188 = c(0, 0),
                                  V189 = c(0, 0),
                                  V190 = c(0, 0),
                                  V191 = c(0, 0),
                                  V192 = c(0, 0),
                                  V193 = c(0, 0),
                                  V194 = c(0, 0),
                                  V195 = c(0, 0),
                                  V196 = c(0, 0),
                                  V197 = c(0, 0),
                                  V1.1 = c(0, 0),
                                  V2.1 = c(0, 0),
                                  V3.1 = c(0, 0),
                                  V4.1 = c(0, 0),
                                  V5.1 = c(0, 0),
                                  V6.1 = c(0, 0),
                                  V7.1 = c(0, 0),
                                  V8.1 = c(0, 0),
                                  V9.1 = c(0, 0),
                                 V10.1 = c(0, 0),
                                 V11.1 = c(0, 0),
                                 V12.1 = c(2, 0),
                                 V13.1 = c(0, 0),
                                 V14.1 = c(0, 0),
                                 V15.1 = c(0, 0),
                                 V16.1 = c(0, 0),
                                 V17.1 = c(0, 0),
                                 V18.1 = c(0, 0),
                                 V19.1 = c(0, 0),
                                 V20.1 = c(0, 0),
                                 V21.1 = c(0, 0),
                                 V22.1 = c(0, 0),
                                 V23.1 = c(0, 0),
                                 V24.1 = c(0, 0),
                                 V25.1 = c(0, 0),
                                 V26.1 = c(0, 0),
                                 V27.1 = c(0, 0),
                                 V28.1 = c(0, 0),
                                 V29.1 = c(0, 0),
                                 V30.1 = c(0, 0),
                                 V31.1 = c(0, 0),
                                 V32.1 = c(0, 0),
                                 V33.1 = c(0, 0),
                                 V34.1 = c(0, 0),
                                 V35.1 = c(0, 0),
                                 V36.1 = c(0, 0),
                                 V37.1 = c(0, 0),
                                 V38.1 = c(0, 0),
                                 V39.1 = c(0, 0),
                                 V40.1 = c(0, 0),
                                 V41.1 = c(0, 0),
                                 V42.1 = c(0, 0),
                                 V43.1 = c(0, 0),
                                 V44.1 = c(0, 0),
                                 V45.1 = c(0, 0),
                                 V46.1 = c(0, 0),
                                 V47.1 = c(0, 0),
                                 V48.1 = c(0, 0),
                                 V49.1 = c(0, 0),
                                 V50.1 = c(0, 0),
                                 V51.1 = c(0, 0),
                                 V52.1 = c(0, 0),
                                 V53.1 = c(0, 0),
                                 V54.1 = c(0, 0),
                                 V55.1 = c(0, 0),
                                 V56.1 = c(0, 0),
                                 V57.1 = c(0, 0),
                                 V58.1 = c(0, 0),
                                 V59.1 = c(0, 0),
                                 V60.1 = c(0, 0),
                                 V61.1 = c(0, 0),
                                 V62.1 = c(0, 0),
                                 V63.1 = c(0, 0),
                                 V64.1 = c(0, 0),
                                 V65.1 = c(0, 0),
                                 V66.1 = c(0, 0),
                                 V67.1 = c(0, 0),
                                 V68.1 = c(0, 0),
                                 V69.1 = c(0, 0),
                                 V70.1 = c(0, 0),
                                 V71.1 = c(0, 0),
                                 V72.1 = c(0, 0),
                                 V73.1 = c(0, 0),
                                 V74.1 = c(0, 0),
                                 V75.1 = c(0, 2),
                                 V76.1 = c(0, 0),
                                 V77.1 = c(0, 0),
                                 V78.1 = c(0, 0),
                                 V79.1 = c(0, 0),
                                 V80.1 = c(0, 0),
                                 V81.1 = c(0, 0),
                                 V82.1 = c(0, 0),
                                 V83.1 = c(0, 0),
                                 V84.1 = c(0, 0),
                                 V85.1 = c(0, 0),
                                 V86.1 = c(0, 0),
                                 V87.1 = c(0, 0),
                                 V88.1 = c(0, 0),
                                 V89.1 = c(0, 0),
                                 V90.1 = c(0, 0),
                                 V91.1 = c(0, 0),
                                 V92.1 = c(0, 0),
                                 V93.1 = c(0, 0),
                                 V94.1 = c(0, 0),
                                 V95.1 = c(0, 0),
                                 V96.1 = c(0, 0),
                                 V97.1 = c(0, 0),
                                 V98.1 = c(0, 0),
                                 V99.1 = c(0, 0),
                                V100.1 = c(0, 0),
                                V101.1 = c(0, 0),
                                V102.1 = c(0, 0),
                                V103.1 = c(0, 0),
                                V104.1 = c(0, 0),
                                V105.1 = c(0, 0),
                                V106.1 = c(0, 0),
                                V107.1 = c(0, 0),
                                V108.1 = c(0, 0),
                                V109.1 = c(0, 0),
                                V110.1 = c(0, 0),
                                V111.1 = c(0, 0),
                                V112.1 = c(0, 0),
                                V113.1 = c(0, 0),
                                V114.1 = c(0, 0),
                                V115.1 = c(0, 0),
                                V116.1 = c(0, 0),
                                V117.1 = c(0, 0),
                                V118.1 = c(0, 0),
                                V119.1 = c(0, 0),
                                V120.1 = c(0, 0),
                                V121.1 = c(0, 0),
                                V122.1 = c(0, 0),
                                V123.1 = c(0, 0),
                                V124.1 = c(0, 0),
                                V125.1 = c(0, 0),
                                V126.1 = c(0, 0),
                                V127.1 = c(0, 0),
                                V128.1 = c(0, 0),
                                V129.1 = c(0, 0),
                                V130.1 = c(0, 0),
                                V131.1 = c(0, 0),
                                V132.1 = c(0, 0),
                                V133.1 = c(0, 0),
                                V134.1 = c(0, 0),
                                V135.1 = c(0, 0),
                                V136.1 = c(0, 0),
                                V137.1 = c(0, 0),
                                V138.1 = c(0, 0),
                                V139.1 = c(0, 0),
                                V140.1 = c(0, 0),
                                V141.1 = c(0, 0),
                                V142.1 = c(0, 0),
                                V143.1 = c(0, 0),
                                V144.1 = c(0, 0),
                                V145.1 = c(0, 0),
                                V146.1 = c(0, 0),
                                V147.1 = c(0, 0),
                                V148.1 = c(0, 0),
                                V149.1 = c(0, 0),
                                V150.1 = c(0, 0),
                                V151.1 = c(0, 0),
                                V152.1 = c(0, 0),
                                V153.1 = c(0, 0),
                                V154.1 = c(0, 0),
                                V155.1 = c(0, 0),
                                V156.1 = c(0, 0),
                                V157.1 = c(0, 0),
                                V158.1 = c(0, 0),
                                V159.1 = c(0, 0),
                                V160.1 = c(0, 0),
                                V161.1 = c(0, 0),
                                V162.1 = c(0, 0),
                                V163.1 = c(0, 0),
                                V164.1 = c(0, 0),
                                V165.1 = c(0, 0),
                                V166.1 = c(0, 0),
                                V167.1 = c(0, 0),
                                V168.1 = c(0, 0),
                                V169.1 = c(0, 0),
                                V170.1 = c(0, 0),
                                V171.1 = c(0, 0),
                                V172.1 = c(0, 0),
                                V173.1 = c(0, 0),
                                V174.1 = c(0, 0),
                                V175.1 = c(0, 0),
                                V176.1 = c(0, 0),
                                V177.1 = c(0, 0),
                                V178.1 = c(0, 0),
                                V179.1 = c(0, 0),
                                V180.1 = c(0, 0),
                                V181.1 = c(0, 0),
                                V182.1 = c(0, 0),
                                V183.1 = c(0, 0),
                                V184.1 = c(0, 0),
                                V185.1 = c(0, 0),
                                V186.1 = c(0, 0),
                                V187.1 = c(0, 0),
                                V188.1 = c(0, 0),
                                V189.1 = c(0, 0),
                                V190.1 = c(0, 0),
                                V191.1 = c(0, 0),
                                V192.1 = c(0, 0),
                                V193.1 = c(0, 0),
                                V194.1 = c(0, 0),
                                V195.1 = c(0, 0),
                                V196.1 = c(0, 0),
                                V197.1 = c(0, 0),
                                  V1.2 = c(0, 0),
                                  V2.2 = c(0, 0),
                                  V3.2 = c(0, 0),
                                  V4.2 = c(0, 0),
                                  V5.2 = c(0, 0),
                                  V6.2 = c(0, 0),
                                  V7.2 = c(0, 0),
                                  V8.2 = c(0, 0),
                                  V9.2 = c(0, 0),
                                 V10.2 = c(0, 0),
                                 V11.2 = c(0, 2),
                                 V12.2 = c(0, 0),
                                 V13.2 = c(0, 0),
                                 V14.2 = c(0, 0),
                                 V15.2 = c(0, 0),
                                 V16.2 = c(0, 0),
                                 V17.2 = c(0, 0),
                                 V18.2 = c(0, 0),
                                 V19.2 = c(2, 0),
                                 V20.2 = c(0, 0),
                                 V21.2 = c(0, 0),
                                 V22.2 = c(0, 0),
                                 V23.2 = c(0, 0),
                                 V24.2 = c(0, 0),
                                 V25.2 = c(0, 0),
                                 V26.2 = c(0, 0),
                                 V27.2 = c(0, 0),
                                 V28.2 = c(0, 0),
                                 V29.2 = c(0, 0),
                                 V30.2 = c(0, 0),
                                 V31.2 = c(0, 0),
                                 V32.2 = c(0, 0),
                                 V33.2 = c(0, 0),
                                 V34.2 = c(0, 0),
                                 V35.2 = c(0, 0),
                                 V36.2 = c(0, 0),
                                 V37.2 = c(0, 0),
                                 V38.2 = c(0, 0),
                                 V39.2 = c(0, 0),
                                 V40.2 = c(0, 0),
                                 V41.2 = c(0, 0),
                                 V42.2 = c(0, 0),
                                 V43.2 = c(0, 0),
                                 V44.2 = c(0, 0),
                                 V45.2 = c(0, 0),
                                 V46.2 = c(0, 0),
                                 V47.2 = c(0, 0),
                                 V48.2 = c(0, 0),
                                 V49.2 = c(0, 0),
                                 V50.2 = c(0, 0),
                                 V51.2 = c(0, 0),
                                 V52.2 = c(0, 0),
                                 V53.2 = c(0, 0),
                                 V54.2 = c(0, 0),
                                 V55.2 = c(0, 0),
                                 V56.2 = c(0, 0),
                                 V57.2 = c(0, 0),
                                 V58.2 = c(0, 0),
                                 V59.2 = c(0, 0),
                                 V60.2 = c(0, 0),
                                 V61.2 = c(0, 0),
                                 V62.2 = c(0, 0),
                                 V63.2 = c(0, 0),
                                 V64.2 = c(0, 0),
                                 V65.2 = c(0, 0),
                                 V66.2 = c(0, 0),
                                 V67.2 = c(0, 0),
                                 V68.2 = c(0, 0),
                                 V69.2 = c(0, 0),
                                 V70.2 = c(0, 0),
                                 V71.2 = c(0, 0),
                                 V72.2 = c(0, 0),
                                 V73.2 = c(0, 0),
                                 V74.2 = c(0, 0),
                                 V75.2 = c(0, 0),
                                 V76.2 = c(0, 0),
                                 V77.2 = c(0, 0),
                                 V78.2 = c(0, 0),
                                 V79.2 = c(0, 0),
                                 V80.2 = c(0, 0),
                                 V81.2 = c(0, 0),
                                 V82.2 = c(0, 0),
                                 V83.2 = c(0, 0),
                                 V84.2 = c(0, 0),
                                 V85.2 = c(0, 0),
                                 V86.2 = c(0, 0),
                                 V87.2 = c(0, 0),
                                 V88.2 = c(0, 0),
                                 V89.2 = c(0, 0),
                                 V90.2 = c(0, 0),
                                 V91.2 = c(0, 0),
                                 V92.2 = c(0, 0),
                                 V93.2 = c(0, 0),
                                 V94.2 = c(0, 0),
                                 V95.2 = c(0, 0),
                                 V96.2 = c(0, 0),
                                 V97.2 = c(0, 0),
                                 V98.2 = c(0, 0),
                                 V99.2 = c(0, 0),
                                V100.2 = c(0, 0),
                                V101.2 = c(0, 0),
                                V102.2 = c(0, 0),
                                V103.2 = c(0, 0),
                                V104.2 = c(0, 0),
                                V105.2 = c(0, 0),
                                V106.2 = c(0, 0),
                                V107.2 = c(0, 0),
                                V108.2 = c(0, 0),
                                V109.2 = c(0, 0),
                                V110.2 = c(0, 0),
                                V111.2 = c(0, 0),
                                V112.2 = c(0, 0),
                                V113.2 = c(0, 0),
                                V114.2 = c(0, 0),
                                V115.2 = c(0, 0),
                                V116.2 = c(0, 0),
                                V117.2 = c(0, 0),
                                V118.2 = c(0, 0),
                                V119.2 = c(0, 0),
                                V120.2 = c(0, 0),
                                V121.2 = c(0, 0),
                                V122.2 = c(0, 0),
                                V123.2 = c(0, 0),
                                V124.2 = c(0, 0),
                                V125.2 = c(0, 0),
                                V126.2 = c(0, 0),
                                V127.2 = c(0, 0),
                                V128.2 = c(0, 0),
                                V129.2 = c(0, 0),
                                V130.2 = c(0, 0),
                                V131.2 = c(0, 0),
                                V132.2 = c(0, 0),
                                V133.2 = c(0, 0),
                                V134.2 = c(0, 0),
                                V135.2 = c(0, 0),
                                V136.2 = c(0, 0),
                                V137.2 = c(0, 0),
                                V138.2 = c(0, 0),
                                V139.2 = c(0, 0),
                                V140.2 = c(0, 0),
                                V141.2 = c(0, 0),
                                V142.2 = c(0, 0),
                                V143.2 = c(0, 0),
                                V144.2 = c(0, 0),
                                V145.2 = c(0, 0),
                                V146.2 = c(0, 0),
                                V147.2 = c(0, 0),
                                V148.2 = c(0, 0),
                                V149.2 = c(0, 0),
                                V150.2 = c(0, 0),
                                V151.2 = c(0, 0),
                                V152.2 = c(0, 0),
                                V153.2 = c(0, 0),
                                V154.2 = c(0, 0),
                                V155.2 = c(0, 0),
                                V156.2 = c(0, 0),
                                V157.2 = c(0, 0),
                                V158.2 = c(0, 0),
                                V159.2 = c(0, 0),
                                V160.2 = c(0, 0),
                                V161.2 = c(0, 0),
                                V162.2 = c(0, 0),
                                V163.2 = c(0, 0),
                                V164.2 = c(0, 0),
                                V165.2 = c(0, 0),
                                V166.2 = c(0, 0),
                                V167.2 = c(0, 0),
                                V168.2 = c(0, 0),
                                V169.2 = c(0, 0),
                                V170.2 = c(0, 0),
                                V171.2 = c(0, 0),
                                V172.2 = c(0, 0),
                                V173.2 = c(0, 0),
                                V174.2 = c(0, 0),
                                V175.2 = c(0, 0),
                                V176.2 = c(0, 0),
                                V177.2 = c(0, 0),
                                V178.2 = c(0, 0),
                                V179.2 = c(0, 0),
                                V180.2 = c(0, 0),
                                V181.2 = c(0, 0),
                                V182.2 = c(0, 0),
                                V183.2 = c(0, 0),
                                V184.2 = c(0, 0),
                                V185.2 = c(0, 0),
                                V186.2 = c(0, 0),
                                V187.2 = c(0, 0),
                                V188.2 = c(0, 0),
                                V189.2 = c(0, 0),
                                V190.2 = c(0, 0),
                                V191.2 = c(0, 0),
                                V192.2 = c(0, 0),
                                V193.2 = c(0, 0),
                                V194.2 = c(0, 0),
                                V195.2 = c(0, 0),
                                V196.2 = c(0, 0),
                                V197.2 = c(0, 0),
     paste..campione...1.5..sep...._.. = as.factor(c("campione_1",
                                                     "campione_2")),
   paste..campione...1.5..sep...._...1 = as.factor(c("campione_1",
                                                     "campione_2")),
   paste..campione...1.5..sep...._...2 = as.factor(c("campione_1",
                                                     "campione_2"))
)

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