0

I am running the following repeated measure ANOVA on such data

anova_test(data,
+            dv = dv, 
+            wid = ID, 
+            within = R,
+            detailed = TRUE,
+            between = Sex,
+            type = 3)

But I am getting the following error:

Run `rlang::last_trace()` to see where the error occurred.
> rlang::last_trace()
<error/rlang_error>
Error in `spread()`:
! Each row of output must be identified by a unique combination of keys.
ℹ Keys are shared for 402 rows
• 1, 2
• 19, 20
• 21, 22
• 24, 25
• 26, 27
• 28, 29
• 30, 31
• 32, 33
• 34, 35
• 36, 37
• 3, 4
• 38, 39
• 40, 41
• 42, 43
• 44, 45
• 46, 47
• 48, 49
• 50, 51
• 52, 53
• 54, 55
• 56, 57
• 5, 6
• 58, 59
• 60, 61
• 62, 63
• 64, 65
• 66, 67
• 68, 69
• 71, 72
• 73, 74
• 75, 76
• 7, 8
• 77, 78
• 79, 80
• 81, 82
• 83, 84
• 85, 86
• 87, 88
• 89, 90
• 91, 92
• 93, 94
• 95, 96
• 9, 10
• 97, 98
• 99, 100
• 101, 102
• 103, 104
• 105, 106
• 107, 108
• 109, 110
• 111, 112
• 113, 114
• 115, 116
• 11, 12
• 117, 118
• 119, 120
• 121, 122
• 123, 124
• 125, 126
• 127, 128
• 129, 130
• 131, 132
• 133, 134
• 135, 136
• 13, 14
• 15, 16
• 17, 18
• 137, 138
• 155, 156
• 157, 158
• 160, 161
• 162, 163
• 164, 165
• 166, 167
• 168, 169
• 170, 171
• 172, 173
• 139, 140
• 174, 175
• 176, 177
• 178, 179
• 180, 181
• 182, 183
• 184, 185
• 186, 187
• 188, 189
• 190, 191
• 192, 193
• 141, 142
• 194, 195
• 196, 197
• 198, 199
• 200, 201
• 202, 203
• 204, 205
• 207, 208
• 209, 210
• 211, 212
• 143, 144
• 213, 214
• 215, 216
• 217, 218
• 219, 220
• 221, 222
• 223, 224
• 225, 226
• 227, 228
• 229, 230
• 231, 232
• 145, 146
• 233, 234
• 235, 236
• 237, 238
• 239, 240
• 241, 242
• 243, 244
• 245, 246
• 247, 248
• 249, 250
• 251, 252
• 147, 148
• 253, 254
• 255, 256
• 257, 258
• 259, 260
• 261, 262
• 263, 264
• 265, 266
• 267, 268
• 269, 270
• 271, 272
• 149, 150
• 151, 152
• 153, 154
• 273, 274
• 291, 292
• 293, 294
• 296, 297
• 298, 299
• 300, 301
• 302, 303
• 304, 305
• 306, 307
• 308, 309
• 275, 276
• 310, 311
• 312, 313
• 314, 315
• 316, 317
• 318, 319
• 320, 321
• 322, 323
• 324, 325
• 326, 327
• 328, 329
• 277, 278
• 330, 331
• 332, 333
• 334, 335
• 336, 337
• 338, 339
• 340, 341
• 343, 344
• 345, 346
• 347, 348
• 279, 280
• 349, 350
• 351, 352
• 353, 354
• 355, 356
• 357, 358
• 359, 360
• 361, 362
• 363, 364
• 365, 366
• 367, 368
• 281, 282
• 369, 370
• 371, 372
• 373, 374
• 375, 376
• 377, 378
• 379, 380
• 381, 382
• 383, 384
• 385, 386
• 387, 388
• 283, 284
• 389, 390
• 391, 392
• 393, 394
• 395, 396
• 397, 398
• 399, 400
• 401, 402
• 403, 404
• 405, 406
• 407, 408
• 285, 286
• 287, 288
• 289, 290
---
Backtrace:
     ▆
  1. ├─rstatix::anova_test(...)
  2. │ ├─... %>% .append_anova_class()
  3. │ └─rstatix (local) .anova_test(...)
  4. │   └─rstatix:::car_anova(.args)
  5. │     └─rstatix::factorial_design(...)
  6. │       └─... %>% as_tibble()
  7. ├─rstatix (local) .append_anova_class(.)
  8. ├─tibble::as_tibble(.)
  9. ├─tidyr::spread(., key = ".group.", value = dv)
 10. └─tidyr:::spread.data.frame(., key = ".group.", value = dv)
Run rlang::last_trace(drop = FALSE) to see 2 hidden frames.

Can anyone having a look to this can understand what it is happening?

12666727b9
  • 1,133
  • 1
  • 8
  • 22
  • Have you tried adding a ```formula``` argument? I'm not exactly sure what you're trying to run. Maybe something like: :```formula=dvar ~ ivar```. Also the ```dv``` variable should be your dependent variable column, but right now it's ```data```... is that a data frame? Also, it would help if you run: ```dput(data)``` and paste the output in your post where ```data``` is the name of your data frame. This helps us see your data and answer your question sooner. – scott.pilgrim.vs.r Sep 01 '23 at 21:23
  • the dependent variable was an error on my end. Possibly I could add this later on – 12666727b9 Sep 02 '23 at 11:57

0 Answers0