summarise_each() with across() for dplyr package - r

I have this script, I want to know how I can replace summarise_each() with the across() function?
common_bw_elements = df %>%
group_by(range_of_commons = cut(common_IDs,
breaks= c(-Inf,0, 5, 10, 20, 30, 60, 100, 200, 300, 600, 1200, 1800, Inf))) %>%
summarise_each(funs(sum), sum_of_instances = frequent)
I am asking this, as I get the following message:
Warning message: summarise_each() is deprecated as of dplyr 0.7.0. Please use across() instead.
My code is very similar to the following post: summarize groups into intervals using dplyr
Any leads on this would be greatly appreciated.
For reference, you can use the following dput()
dput(df)
structure(list(common_IDs = c(0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 17L, 18L, 25L, 26L, 27L, 37L, 51L, 55L, 56L, 63L, 68L, 69L, 70L, 71L, 74L, 76L, 81L, 84L, 86L, 87L, 89L, 90L, 91L, 92L, 101L,
103L, 108L, 109L, 110L, 113L, 114L, 115L, 116L, 129L, 130L, 131L, 133L, 135L, 136L, 137L, 138L, 139L, 141L, 152L, 153L, 154L, 177L, 178L, 190L, 191L, 196L, 199L, 202L, 203L, 208L, 209L, 210L, 211L, 213L, 214L, 215L, 216L, 218L, 219L, 222L, 223L, 229L, 230L, 231L,
232L, 239L, 251L, 252L, 254L, 257L, 264L, 265L, 271L, 272L, 273L, 275L, 276L, 277L, 280L, 293L, 294L, 297L, 298L, 299L, 300L, 301L, 304L, 317L, 320L, 337L, 346L, 347L, 364L, 371L, 373L, 386L, 387L, 389L, 412L, 417L, 419L, 420L, 432L, 440L, 441L, 442L, 443L, 451L,
452L, 453L, 455L, 456L, 457L, 458L, 462L, 463L, 464L, 469L, 470L, 474L, 476L, 477L, 478L, 487L, 488L, 492L, 1484L, 1534L, 1546L, 1561L, 1629L, 1642L, 1670L, 1672L, 1681L, 1698L, 1723L, 1725L,
1736L, 1738L, 1745L, 1753L, 1759L, 1764L, 1766L, 1767L, 1770L, 1772L, 1775L, 1776L, 1781L, 1784L, 1787L, 1791L, 1802L, 1807L, 1813L, 1815L, 1817L, 1821L, 1823L, 1825L, 1846L, 1850L, 1852L,
1853L, 1854L, 1857L, 1858L, 1859L, 1868L, 1899L, 1904L, 1911L, 1913L, 1977L, 1997L, 1999L, 2023L, 2079L),
frequent = c(81L, 75L, 10L, 17L, 4L, 4L, 33L, 13L, 31L, 3L, 19L, 22L, 6L, 1L, 11L, 2L,
1L, 1L, 3L, 14L, 1L, 2L, 1L, 14L, 1L, 9L, 6L, 9L, 2L, 5L, 13L, 4L, 4L, 1L, 4L, 1L, 3L, 1L, 6L, 2L, 1L, 3L, 2L, 5L, 2L, 1L, 17L, 5L, 4L, 4L, 1L, 4L, 7L, 3L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 6L,
16L, 3L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 5L, 13L, 6L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 4L, 2L, 1L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 3L, 5L, 1L, 3L, 1L, 3L, 4L, 1L, 1L, 2L, 3L, 4L, 3L, 3L, 1L, 3L, 2L, 2L, 1L, 6L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L)),
class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA, -193L))

You can use summarise since you are only summing one variable by group.
library(tidyverse)
common_bw_elements = df %>%
group_by(range_of_commons = cut(common_IDs,
breaks= c(-Inf,0, 5, 10, 20, 30, 60, 100, 200, 300, 600, 1200, 1800, Inf))) %>%
summarise(sum_of_instances = sum(frequent))
Output
range_of_commons sum_of_instances
<fct> <int>
1 (-Inf,0] 81
2 (0,5] 110
3 (5,10] 46
4 (10,20] 34
5 (20,30] 47
6 (30,60] 15
7 (60,100] 85
8 (100,200] 87
9 (200,300] 92
10 (300,600] 75
11 (1.2e+03,1.8e+03] 29
12 (1.8e+03, Inf] 28
If you had multiple columns to sum, then we would use across (or if you only had a few columns, then instead of everything(), you can provide a vector of column names (e.g., c(common_IDs, frequent)):
df %>%
group_by(range_of_commons = cut(common_IDs,
breaks= c(-Inf,0, 5, 10, 20, 30, 60, 100, 200, 300, 600, 1200, 1800, Inf))) %>%
summarise(across(everything(), ~ sum(.x))) %>%
rename(sum_of_instances = frequent)
Output
range_of_commons common_IDs sum_of_instances
<fct> <int> <int>
1 (-Inf,0] 0 81
2 (0,5] 15 110
3 (5,10] 13 46
4 (10,20] 35 34
5 (20,30] 78 47
6 (30,60] 199 15
7 (60,100] 1191 85
8 (100,200] 3928 87
9 (200,300] 9392 92
10 (300,600] 17290 75
11 (1.2e+03,1.8e+03] 47829 29
12 (1.8e+03, Inf] 48922 28

Related

If-Else Statement in R with 3 conditions

I am trying to use an if-else statement to create a column in my data set. I want this if-else statement to create a column called "Surgical" in the df "option1" that displays the value of the column "Duration" subtracted by 20 ONLY IF the value in Duration is above 625, AND the factor "Single" is indicated in the column "Variability".
I have tried the following code:
option1$Surgical <- ifelse(option1$Variability == "Single", option1$Duration - 20, option1$Duration)
Any insight into how to specify the "only if the value is greater than 625" portion is appreciated!!
Df "option 1" for reference.
dput(option1)
structure(list(Stimulus = structure(c(36L, 37L, 38L, 39L, 40L,
41L, 42L, 43L, 44L, 45L, 50L, 51L, 52L, 53L, 54L, 55L, 56L, 60L,
61L, 62L, 63L, 64L, 65L, 66L, 67L, 73L, 74L, 75L, 76L, 77L, 78L,
79L, 31L, 32L, 33L, 34L, 35L, 36L, 37L, 38L, 39L, 40L, 46L, 47L,
48L, 49L, 50L, 51L, 52L, 53L, 57L, 58L, 59L, 60L, 61L, 62L, 63L,
69L, 70L, 71L, 72L, 73L, 74L, 75L, 36L, 37L, 38L, 39L, 40L, 41L,
42L, 43L, 44L, 45L, 50L, 51L, 52L, 53L, 54L, 55L, 56L, 60L, 61L,
62L, 63L, 64L, 65L, 66L, 67L, 73L, 74L, 75L, 76L, 77L, 78L, 79L,
31L, 32L, 33L, 34L, 35L, 36L, 37L, 38L, 39L, 40L, 46L, 47L, 48L,
49L, 50L, 51L, 52L, 53L, 57L, 58L, 59L, 60L, 61L, 62L, 63L, 69L,
70L, 71L, 72L, 73L, 74L, 75L, 7L, 9L, 12L, 18L, 28L, 26L, 51L,
37L, 3L, 2L, 19L, 14L, 27L, 23L, 65L, 77L, 7L, 9L, 12L, 18L,
28L, 26L, 51L, 37L, 3L, 2L, 19L, 14L, 27L, 23L, 65L, 77L, 5L,
11L, 20L, 16L, 30L, 25L, 35L, 33L, 7L, 9L, 12L, 18L, 28L, 26L,
51L, 37L, 5L, 11L, 20L, 16L, 30L, 25L, 35L, 33L, 7L, 9L, 12L,
18L, 28L, 26L, 51L, 37L), .Label = c("t1_block2_hoed3.mp3", "t1_block2_whod3.mp3",
"t1_block2_whod4.mp3", "t1_block2_whod5.mp3", "t1_block3_heed2.mp3",
"t1_block3_heed5.mp3", "t1_block3_hoed1.mp3", "t1_block3_hoed2.mp3",
"t1_block3_hoed4.mp3", "t1_block3_whod3.mp3", "t1_block4_heed5.mp3",
"t2_block1_hoed3.mp3", "t2_block1_whod1.mp3", "t2_block1_whod2.mp3",
"t2_block1_whod4.mp3", "t2_block2_heed3.mp3", "t2_block2_hoed5.mp3",
"t2_block3_hoed1.mp3", "t2_block3_whod1.mp3", "t2_block4_heed2.mp3",
"t2_block4_heed5.mp3", "t3_block1_heed1.mp3", "t3_block1_whod2.mp3",
"t3_block1_whod5.mp3", "t3_block2_heed5.mp3", "t3_block2_hoed2.mp3",
"t3_block2_whod5.mp3", "t3_block3_hoed1.mp3", "t3_block3_hoed4.mp3",
"t3_block4_heed3.mp3", "t4_block1_heed1.mp3", "t4_block1_heed2.mp3",
"t4_block1_heed3.mp3", "t4_block1_heed4.mp3", "t4_block1_heed5.mp3",
"t4_block1_hoed1.mp3", "t4_block1_hoed2.mp3", "t4_block1_hoed3.mp3",
"t4_block1_hoed4.mp3", "t4_block1_hoed5.mp3", "t4_block1_whod1.mp3",
"t4_block1_whod2.mp3", "t4_block1_whod3.mp3", "t4_block1_whod4.mp3",
"t4_block1_whod5.mp3", "t4_block2_heed1.mp3", "t4_block2_heed2.mp3",
"t4_block2_heed4.mp3", "t4_block2_heed5.mp3", "t4_block2_hoed1.mp3",
"t4_block2_hoed3.mp3", "t4_block2_hoed4.mp3", "t4_block2_hoed5.mp3",
"t4_block2_whod2.mp3", "t4_block2_whod4.mp3", "t4_block2_whod5.mp3",
"t4_block3_heed1.mp3", "t4_block3_heed4.mp3", "t4_block3_heed5.mp3",
"t4_block3_hoed1.mp3", "t4_block3_hoed2.mp3", "t4_block3_hoed4.mp3",
"t4_block3_hoed5.mp3", "t4_block3_whod1.mp3", "t4_block3_whod2.mp3",
"t4_block3_whod3.mp3", "t4_block3_whod5.mp3", "t4_block4_heed1.mp3",
"t4_block4_heed2.mp3", "t4_block4_heed3.mp3", "t4_block4_heed4.mp3",
"t4_block4_heed5.mp3", "t4_block4_hoed1.mp3", "t4_block4_hoed2.mp3",
"t4_block4_hoed3.mp3", "t4_block4_whod1.mp3", "t4_block4_whod2.mp3",
"t4_block4_whod3.mp3", "t4_block4_whod5.mp3"), class = "factor"),
Duration = c(497L, 517L, 580L, 563L, 569L, 486L, 506L, 536L,
545L, 554L, 516L, 600L, 607L, 577L, 537L, 583L, 544L, 566L,
567L, 616L, 652L, 564L, 517L, 612L, 564L, 632L, 662L, 565L,
594L, 622L, 552L, 542L, 539L, 554L, 600L, 607L, 577L, 497L,
517L, 580L, 563L, 569L, 594L, 563L, 623L, 602L, 516L, 600L,
607L, 577L, 531L, 642L, 624L, 566L, 567L, 616L, 652L, 654L,
576L, 556L, 608L, 632L, 662L, 565L, 497L, 517L, 580L, 563L,
569L, 486L, 506L, 536L, 545L, 554L, 516L, 600L, 607L, 577L,
537L, 583L, 544L, 566L, 567L, 616L, 652L, 564L, 517L, 612L,
564L, 632L, 662L, 565L, 594L, 622L, 552L, 542L, 539L, 554L,
600L, 607L, 577L, 497L, 517L, 580L, 563L, 569L, 594L, 563L,
623L, 602L, 516L, 600L, 607L, 577L, 531L, 642L, 624L, 566L,
567L, 616L, 652L, 654L, 576L, 556L, 608L, 632L, 662L, 565L,
452L, 547L, 510L, 663L, 470L, 503L, 600L, 517L, 491L, 505L,
641L, 581L, 520L, 485L, 517L, 622L, 452L, 547L, 510L, 663L,
470L, 503L, 600L, 517L, 491L, 505L, 641L, 581L, 520L, 485L,
517L, 622L, 510L, 458L, 558L, 638L, 483L, 538L, 577L, 600L,
452L, 547L, 510L, 663L, 470L, 503L, 600L, 517L, 510L, 458L,
558L, 638L, 483L, 538L, 577L, 600L, 452L, 547L, 510L, 663L,
470L, 503L, 600L, 517L), F0 = c(196L, 204L, 204L, 197L, 203L,
216L, 208L, 223L, 213L, 219L, 196L, 202L, 205L, 202L, 208L,
205L, 206L, 197L, 202L, 195L, 200L, 201L, 210L, 202L, 208L,
195L, 196L, 195L, 205L, 208L, 203L, 203L, 212L, 213L, 210L,
206L, 204L, 196L, 204L, 204L, 197L, 203L, 201L, 198L, 199L,
203L, 196L, 202L, 205L, 202L, 193L, 195L, 208L, 197L, 202L,
195L, 200L, 201L, 195L, 205L, 202L, 195L, 196L, 195L, 196L,
204L, 204L, 197L, 203L, 216L, 208L, 223L, 213L, 219L, 196L,
202L, 205L, 202L, 208L, 205L, 206L, 197L, 202L, 195L, 200L,
201L, 210L, 202L, 208L, 195L, 196L, 195L, 205L, 208L, 203L,
203L, 212L, 213L, 210L, 206L, 204L, 196L, 204L, 204L, 197L,
203L, 201L, 198L, 199L, 203L, 196L, 202L, 205L, 202L, 193L,
195L, 208L, 197L, 202L, 195L, 200L, 201L, 195L, 205L, 202L,
195L, 196L, 195L, 215L, 219L, 219L, 220L, 199L, 202L, 202L,
204L, 224L, 231L, 238L, 240L, 217L, 212L, 210L, 208L, 215L,
219L, 219L, 220L, 199L, 202L, 202L, 204L, 224L, 231L, 238L,
240L, 217L, 212L, 210L, 208L, 230L, 223L, 219L, 221L, 199L,
200L, 204L, 210L, 215L, 219L, 219L, 220L, 199L, 202L, 202L,
204L, 230L, 223L, 219L, 221L, 199L, 200L, 204L, 210L, 215L,
219L, 219L, 220L, 199L, 202L, 202L, 204L), F1 = c(576L, 553L,
579L, 586L, 601L, 398L, 390L, 398L, 389L, 404L, 587L, 560L,
562L, 553L, 393L, 397L, 382L, 553L, 592L, 556L, 571L, 387L,
392L, 398L, 400L, 580L, 580L, 554L, 403L, 391L, 388L, 393L,
382L, 375L, 384L, 392L, 388L, 576L, 553L, 579L, 586L, 601L,
387L, 393L, 402L, 406L, 587L, 560L, 562L, 553L, 388L, 391L,
412L, 553L, 592L, 556L, 571L, 410L, 404L, 401L, 420L, 580L,
580L, 554L, 576L, 553L, 579L, 586L, 601L, 398L, 390L, 398L,
389L, 404L, 587L, 560L, 562L, 553L, 393L, 397L, 382L, 553L,
592L, 556L, 571L, 387L, 392L, 398L, 400L, 580L, 580L, 554L,
403L, 391L, 388L, 393L, 382L, 375L, 384L, 392L, 388L, 576L,
553L, 579L, 586L, 601L, 387L, 393L, 402L, 406L, 587L, 560L,
562L, 553L, 388L, 391L, 412L, 553L, 592L, 556L, 571L, 410L,
404L, 401L, 420L, 580L, 580L, 554L, 620L, 630L, 602L, 605L,
571L, 573L, 560L, 553L, 434L, 417L, 306L, 319L, 414L, 419L,
392L, 391L, 620L, 630L, 602L, 605L, 571L, 573L, 560L, 553L,
434L, 417L, 306L, 319L, 414L, 419L, 392L, 391L, 448L, 441L,
293L, 291L, 420L, 420L, 388L, 384L, 620L, 630L, 602L, 605L,
571L, 573L, 560L, 553L, 448L, 441L, 293L, 291L, 420L, 420L,
388L, 384L, 620L, 630L, 602L, 605L, 571L, 573L, 560L, 553L
), F2 = c(1339L, 1381L, 1381L, 1347L, 1394L, 1484L, 1521L,
1539L, 1430L, 1454L, 1353L, 1378L, 1325L, 1357L, 1424L, 1563L,
1578L, 1350L, 1397L, 1273L, 1319L, 1548L, 1452L, 1499L, 1515L,
1358L, 1347L, 1248L, 1575L, 1438L, 1414L, 1548L, 3001L, 2916L,
2948L, 2973L, 2947L, 1339L, 1381L, 1381L, 1347L, 1394L, 2943L,
2913L, 2987L, 2940L, 1353L, 1378L, 1325L, 1357L, 3010L, 3008L,
2972L, 1350L, 1397L, 1273L, 1319L, 2963L, 2991L, 3007L, 2989L,
1358L, 1347L, 1248L, 1339L, 1381L, 1381L, 1347L, 1394L, 1484L,
1521L, 1539L, 1430L, 1454L, 1353L, 1378L, 1325L, 1357L, 1424L,
1563L, 1578L, 1350L, 1397L, 1273L, 1319L, 1548L, 1452L, 1499L,
1515L, 1358L, 1347L, 1248L, 1575L, 1438L, 1414L, 1548L, 3001L,
2916L, 2948L, 2973L, 2947L, 1339L, 1381L, 1381L, 1347L, 1394L,
2943L, 2913L, 2987L, 2940L, 1353L, 1378L, 1325L, 1357L, 3010L,
3008L, 2972L, 1350L, 1397L, 1273L, 1319L, 2963L, 2991L, 3007L,
2989L, 1358L, 1347L, 1248L, 1247L, 1244L, 1293L, 1264L, 1348L,
1354L, 1378L, 1381L, 1314L, 1233L, 1190L, 1208L, 1643L, 1659L,
1452L, 1438L, 1247L, 1244L, 1293L, 1264L, 1348L, 1354L, 1378L,
1381L, 1314L, 1233L, 1190L, 1208L, 1643L, 1659L, 1452L, 1438L,
2837L, 2816L, 2780L, 2776L, 2684L, 2718L, 2947L, 2948L, 1247L,
1244L, 1293L, 1264L, 1348L, 1354L, 1378L, 1381L, 2837L, 2816L,
2780L, 2776L, 2684L, 2718L, 2947L, 2948L, 1247L, 1244L, 1293L,
1264L, 1348L, 1354L, 1378L, 1381L), F3 = c(2831L, 2779L,
2915L, 2875L, 2712L, 2730L, 2793L, 2779L, 2772L, 2692L, 2718L,
2856L, 2674L, 2659L, 2717L, 2584L, 2829L, 2726L, 2685L, 2866L,
2793L, 2614L, 2636L, 2907L, 2822L, 2932L, 2882L, 2882L, 2650L,
2929L, 2809L, 2737L, 3623L, 3607L, 3584L, 3576L, 3680L, 2831L,
2779L, 2915L, 2875L, 2712L, 3641L, 3590L, 3556L, 3584L, 2718L,
2856L, 2674L, 2659L, 3640L, 3656L, 3686L, 2726L, 2685L, 2866L,
2793L, 3516L, 3552L, 3513L, 3579L, 2932L, 2882L, 2882L, 2831L,
2779L, 2915L, 2875L, 2712L, 2730L, 2793L, 2779L, 2772L, 2692L,
2718L, 2856L, 2674L, 2659L, 2717L, 2584L, 2829L, 2726L, 2685L,
2866L, 2793L, 2614L, 2636L, 2907L, 2822L, 2932L, 2882L, 2882L,
2650L, 2929L, 2809L, 2737L, 3623L, 3607L, 3584L, 3576L, 3680L,
2831L, 2779L, 2915L, 2875L, 2712L, 3641L, 3590L, 3556L, 3584L,
2718L, 2856L, 2674L, 2659L, 3640L, 3656L, 3686L, 2726L, 2685L,
2866L, 2793L, 3516L, 3552L, 3513L, 3579L, 2932L, 2882L, 2882L,
2711L, 3129L, 2786L, 2833L, 2754L, 2771L, 2856L, 2779L, 2909L,
2750L, 2866L, 2863L, 2804L, 2704L, 2636L, 2929L, 2711L, 3129L,
2786L, 2833L, 2754L, 2771L, 2856L, 2779L, 2909L, 2750L, 2866L,
2863L, 2804L, 2704L, 2636L, 2929L, 3226L, 3121L, 3867L, 3319L,
3426L, 3269L, 3680L, 3357L, 2711L, 3129L, 2786L, 2833L, 2754L,
2771L, 2856L, 2779L, 3226L, 3121L, 3867L, 3319L, 3426L, 3269L,
3680L, 3357L, 2711L, 3129L, 2786L, 2833L, 2754L, 2771L, 2856L,
2779L), Word = structure(c(2L, 2L, 2L, 2L, 2L, 4L, 4L, 4L,
4L, 4L, 2L, 2L, 2L, 2L, 4L, 4L, 4L, 2L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4L, 4L, 4L, 2L, 2L, 2L, 2L, 4L,
4L, 4L, 2L, 2L, 2L, 2L, 4L, 4L, 4L, 4L, 2L, 2L, 2L, 4L, 4L,
4L, 4L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L,
1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L,
1L, 2L, 2L, 2L, 3L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("i", "o", "o ",
"u"), class = "factor"), F1.Mean = c(564L, 564L, 564L, 564L,
564L, 394L, 394L, 394L, 394L, 394L, 564L, 564L, 564L, 564L,
394L, 394L, 394L, 564L, 564L, 564L, 564L, 394L, 394L, 394L,
394L, 564L, 564L, 564L, 394L, 394L, 394L, 394L, 398L, 398L,
398L, 398L, 398L, 564L, 564L, 564L, 564L, 564L, 398L, 398L,
398L, 398L, 564L, 564L, 564L, 564L, 398L, 398L, 398L, 564L,
564L, 564L, 564L, 398L, 398L, 398L, 398L, 564L, 564L, 564L,
564L, 564L, 564L, 564L, 564L, 394L, 394L, 394L, 394L, 394L,
564L, 564L, 564L, 564L, 394L, 394L, 394L, 564L, 564L, 564L,
564L, 394L, 394L, 394L, 394L, 564L, 564L, 564L, 394L, 394L,
394L, 394L, 398L, 398L, 398L, 398L, 398L, 564L, 564L, 564L,
564L, 564L, 398L, 398L, 398L, 398L, 564L, 564L, 564L, 564L,
398L, 398L, 398L, 564L, 564L, 564L, 564L, 398L, 398L, 398L,
398L, 564L, 564L, 564L, 627L, 627L, 614L, 614L, 614L, 614L,
566L, 566L, 432L, 432L, 327L, 327L, 415L, 415L, 393L, 393L,
627L, 627L, 614L, 614L, 614L, 614L, 566L, 566L, 432L, 432L,
327L, 327L, 415L, 415L, 393L, 393L, 397L, 397L, 292L, 292L,
417L, 417L, 398L, 398L, 627L, 627L, 614L, 614L, 614L, 614L,
566L, 566L, 397L, 397L, 292L, 292L, 417L, 417L, 398L, 398L,
627L, 627L, 614L, 614L, 614L, 614L, 566L, 566L), F2.Mean = c(1328L,
1328L, 1328L, 1328L, 1328L, 1496L, 1496L, 1496L, 1496L, 1496L,
1328L, 1328L, 1328L, 1328L, 1496L, 1496L, 1496L, 1328L, 1328L,
1328L, 1328L, 1496L, 1496L, 1496L, 1496L, 1328L, 1328L, 1328L,
1496L, 1496L, 1496L, 1496L, 2969L, 2969L, 2969L, 2969L, 2969L,
1328L, 1328L, 1328L, 1328L, 1328L, 2969L, 2969L, 2969L, 2969L,
1328L, 1328L, 1328L, 1328L, 2969L, 2969L, 2969L, 1328L, 1328L,
1328L, 1328L, 2969L, 2969L, 2969L, 2969L, 1328L, 1328L, 1328L,
1328L, 1328L, 1328L, 1328L, 1328L, 1496L, 1496L, 1496L, 1496L,
1496L, 1328L, 1328L, 1328L, 1328L, 1496L, 1496L, 1496L, 1328L,
1328L, 1328L, 1328L, 1496L, 1496L, 1496L, 1496L, 1328L, 1328L,
1328L, 1496L, 1496L, 1496L, 1496L, 2969L, 2969L, 2969L, 2969L,
2969L, 1328L, 1328L, 1328L, 1328L, 1328L, 2969L, 2969L, 2969L,
2969L, 1328L, 1328L, 1328L, 1328L, 2969L, 2969L, 2969L, 1328L,
1328L, 1328L, 1328L, 2969L, 2969L, 2969L, 2969L, 1328L, 1328L,
1328L, 1250L, 1250L, 1247L, 1247L, 1247L, 1247L, 1357L, 1357L,
1292L, 1292L, 1157L, 1157L, 1746L, 1746L, 1455L, 1455L, 1250L,
1250L, 1247L, 1247L, 1247L, 1247L, 1357L, 1357L, 1292L, 1292L,
1157L, 1157L, 1746L, 1746L, 1455L, 1455L, 2828L, 2828L, 2763L,
2763L, 2721L, 2721L, 2969L, 2969L, 1250L, 1250L, 1247L, 1247L,
1247L, 1247L, 1357L, 1357L, 2828L, 2828L, 2763L, 2763L, 2721L,
2721L, 2969L, 2969L, 1250L, 1250L, 1247L, 1247L, 1247L, 1247L,
1357L, 1357L), Distance = c(16L, 54L, 55L, 29L, 76L, 13L,
25L, 43L, 66L, 43L, 34L, 50L, 4L, 31L, 72L, 67L, 83L, 25L,
74L, 56L, 11L, 52L, 44L, 5L, 20L, 34L, 25L, 81L, 80L, 58L,
82L, 52L, 36L, 58L, 25L, 7L, 24L, 16L, 54L, 55L, 29L, 76L,
28L, 56L, 18L, 30L, 34L, 50L, 4L, 31L, 42L, 40L, 14L, 25L,
74L, 56L, 11L, 13L, 23L, 38L, 30L, 34L, 25L, 81L, 16L, 54L,
55L, 29L, 76L, 13L, 25L, 43L, 66L, 43L, 34L, 50L, 4L, 31L,
72L, 67L, 83L, 25L, 74L, 56L, 11L, 52L, 44L, 5L, 20L, 34L,
25L, 81L, 80L, 58L, 82L, 52L, 36L, 58L, 25L, 7L, 24L, 16L,
54L, 55L, 29L, 76L, 28L, 56L, 18L, 30L, 34L, 50L, 4L, 31L,
42L, 40L, 14L, 25L, 74L, 56L, 11L, 13L, 23L, 38L, 30L, 34L,
25L, 81L, 8L, 7L, 48L, 19L, 110L, 115L, 22L, 27L, 22L, 61L,
39L, 52L, 103L, 87L, 3L, 17L, 8L, 7L, 48L, 19L, 110L, 115L,
22L, 27L, 22L, 61L, 39L, 52L, 103L, 87L, 3L, 17L, 52L, 46L,
17L, 13L, 37L, 4L, 24L, 25L, 8L, 7L, 48L, 19L, 110L, 115L,
22L, 27L, 52L, 46L, 17L, 13L, 37L, 4L, 24L, 25L, 8L, 7L,
48L, 19L, 110L, 115L, 22L, 27L), Included = structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1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1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L), .Label = c("Mixed", "Single"), class = "factor"),
Consistency = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L), .Label = c("Consistent", "Inconsistent"), class = "factor"),
Fake = c(477, 497, 560, 543, 549, 466, 486, 516, 525, 534,
496, 580, 587, 557, 517, 563, 524, 546, 547, 596, 632, 544,
497, 592, 544, 612, 642, 545, 574, 602, 532, 522, 519, 534,
580, 587, 557, 477, 497, 560, 543, 549, 574, 543, 603, 582,
496, 580, 587, 557, 511, 622, 604, 546, 547, 596, 632, 634,
556, 536, 588, 612, 642, 545, 477, 497, 560, 543, 549, 466,
486, 516, 525, 534, 496, 580, 587, 557, 517, 563, 524, 546,
547, 596, 632, 544, 497, 592, 544, 612, 642, 545, 574, 602,
532, 522, 519, 534, 580, 587, 557, 477, 497, 560, 543, 549,
574, 543, 603, 582, 496, 580, 587, 557, 511, 622, 604, 546,
547, 596, 632, 634, 556, 536, 588, 612, 642, 545, 452, 547,
510, 663, 470, 503, 600, 517, 491, 505, 641, 581, 520, 485,
517, 622, 452, 547, 510, 663, 470, 503, 600, 517, 491, 505,
641, 581, 520, 485, 517, 622, 510, 458, 558, 638, 483, 538,
577, 600, 452, 547, 510, 663, 470, 503, 600, 517, 510, 458,
558, 638, 483, 538, 577, 600, 452, 547, 510, 663, 470, 503,
600, 517), Check = c(20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0)), row.names = c(NA, -192L), class = "data.frame")
We can check multiple conditions with & or |. Here, we would need & because both the conditions should be satisfied
option1$Surgical <- ifelse(option1$Variability == "Single" &
option1$Duration > 625, option1$Duration - 20, option1$Duration)
You can do this directly without using ifelse :
option1$Surgical <- with(option1, Duration - (20 *
(Variability == 'Single' & Duration > 625)))
Here, we take advantage of the fact that
20 * TRUE #gives
#[1] 20
and
20 * FALSE #gives
#[1] 0
So whenever the condition (Variability == 'Single' & Duration > 625) is TRUE it subtracts 20 from Duration or else 0.

Identify function is not accurate in R

Here is the problem:
When I use cook's distance to check influential points in SLR, I used two methods.
First one:
plot(mortality.model, which = 4)
This one gives me the correct answer.
Second one:
plot(cooks.distance(mortality.model), type = 'p')
identify(cooks.distance(mortality.model))
This one gives me the wrong answer, but very close to the correct answer.
Read the data set:
df.mortality <- read.csv("mortality.csv", header = TRUE)
Build the model:
mortality.model <- lm(log(infant) ~ log(income))
By the way, the dataset has NA values. If you would like to see the dataset, I could email it to you.
The dput result:
structure(list(X = structure(c(4L, 5L, 7L, 15L, 23L, 29L, 30L, 101L,
41L,43L, 46L, 61L, 62L, 66L, 73L, 79L, 86L, 87L, 10L, 97L, 2L, 25L, 38L,
39L, 40L, 52L, 65L, 75L, 100L, 3L, 9L, 18L, 19L, 21L, 24L, 32L, 33L, 42L,
45L, 50L, 55L, 58L, 63L, 68L, 71L, 77L, 83L, 89L, 93L, 94L, 99L, 103L,
105L, 8L, 14L, 20L, 26L, 27L, 31L, 36L, 44L, 47L, 80L, 51L, 59L, 69L, 70L,
72L, 88L, 91L, 95L, 81L, 1L, 6L,11L, 12L, 13L, 16L, 17L, 22L, 28L, 34L,
35L, 37L, 48L, 49L, 53L, 54L, 56L, 57L, 60L, 64L, 67L, 74L, 76L, 78L, 84L,
85L, 90L, 92L, 96L, 98L, 82L, 102L, 104L), .Label = c("Afganistan",
"Algeria", "Argentina", "Australia", "Austria", "Bangladesh","Belgium",
"Bolivia", "Brazil", "Britain", "Burma","Burundi","Cambodia","Cameroon",
"Canada", "Central.African.Republic", "Chad","Chile", "Colombia","Congo",
"Costa.Rica", "Dahomey", "Denmark", "Dominican.Republic", "Ecuador",
"Egypt", "El.Salvador", "Ethiopia", "Finland", "France", "Ghana",
"Greece", "Guatemala", "Guinea", "Haiti", "Honduras", "India",
"Indonesia", "Iran", "Iraq", "Ireland", "Israel", "Italy", "Ivory.Coast",
"Jamaica", "Japan", "Jordan", "Kenya", "Laos", "Lebanon", "Liberia",
"Libya", "Madagascar", "Malawi", "Malaysia", "Mali", "Mauritania",
"Mexico", "Moroco", "Nepal", "Netherlands", "New.Zealand", "Nicaragua",
"Niger", "Nigeria", "Norway", "Pakistan", "Panama", "Papua.New.Guinea",
"Paraguay", "Peru", "Philippines", "Portugal", "Rwanda", "Saudi.Arabia",
"Sierra.Leone", "Singapore", "Somalia", "South.Africa", "South.Korea",
"South.Vietnam", "Southern.Yemen", "Spain", "Sri.Lanka", "Sudan",
"Sweden", "Switzerland", "Syria", "Taiwan", "Tanzania", "Thailand",
"Togo", "Trinidad.and.Tobago", "Tunisia", "Turkey", "Uganda",
"United.States", "Upper.Volta", "Uruguay", "Venezuela", "West.Germany",
"Yemen", "Yugoslavia", "Zaire", "Zambia"), class = "factor"),
income = c(3426L, 3350L, 3346L, 4751L, 5029L, 3312L, 3403L,
5040L, 2009L, 2298L, 3292L, 4103L, 3723L, 4102L, 956L, 1000L,
5596L, 2963L, 2503L, 5523L, 400L, 250L, 110L, 1280L, 560L,
3010L, 220L, 1530L, 1240L, 1191L, 425L, 590L, 426L, 725L,
406L, 1760L, 302L, 2526L, 727L, 631L, 295L, 684L, 507L, 754L,
335L, 1268L, 1256L, 261L, 732L, 434L, 799L, 406L, 310L, 200L,
100L, 281L, 210L, 319L, 217L, 284L, 387L, 334L, 344L, 197L,
279L, 477L, 347L, 230L, 334L, 210L, 435L, 130L, 75L, 100L,
73L, 68L, 123L, 122L, 70L, 81L, 79L, 79L, 100L, 93L, 169L,
71L, 120L, 130L, 50L, 174L, 90L, 70L, 102L, 61L, 148L, 85L,
162L, 125L, 120L, 160L, 134L, 82L, 96L, 77L, 118L), infant = c(26.7,
23.7, 17, 16.8, 13.5, 10.1, 12.9, 20.4, 17.8, 25.7, 11.7,
11.6, 16.2, 11.3, 44.8, 71.5, 9.6, 12.8, 17.5, 17.6, 86.3,
78.5, 125, NA, 28.1, 300, 58, 650, 51.7, 59.6, 170, 78, 62.8,
54.4, 48.8, 27.8, 79.1, 22.1, 26.2, 13.6, 32, 60.9, 46, 34.1,
65.1, 20.4, 15.1, 19.1, 26.2, 76.3, 40.4, 43.3, 259, 60.4,
137, 180, 114, 58.2, 63.7, 39.3, 138, 21.3, 58, 159.2, 149,
10.2, 38.6, 67.9, 21.7, 27, 153, 100, 400, 124.3, 200, 150,
100, 190, 160, 109.6, 84.2, 216, NA, 60.6, 55, NA, 102, 148.3,
120, 187, NA, 200, 124.3, 132.9, 170, 158, 45.1, 129.4, 162.5,
127, 160, 180, 80, 50, 104), region = structure(c(3L, 4L,
4L, 2L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 3L, 4L, 4L, 1L, 4L,
4L, 4L, 2L, 1L, 2L, 3L, 3L, 3L, 1L, 1L, 3L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 4L, 2L, 3L, 2L, 3L, 3L, 2L, 2L, 2L, 2L, 3L, 4L,
3L, 2L, 1L, 2L, 4L, 1L, 2L, 1L, 1L, 1L, 2L, 1L, 2L, 1L, 3L,
3L, 1L, 1L, 3L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 1L, 3L,
1L, 1L, 1L, 1L, 1L, 2L, 3L, 1L, 3L, 1L, 1L, 1L, 1L, 3L, 1L,
3L, 1L, 1L, 1L, 3L, 1L, 1L, 1L, 1L, 1L, 3L, 3L, 1L), .Label = c("Africa",
"Americas", "Asia", "Europe"), class = "factor"), oil = structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("no",
"yes"), class = "factor")), class = "data.frame", row.names = c(NA,
-105L))
Thanks!
Here are results:The correct answer The wrong answer
Could anyone explain why it happened?

Re arrange eye tracking data

I have an eye tracking data file which I need to transform. Let me explain, my data are formated like this:
Event; Info; Pupil size
Message; Start_trial_0;
Fixation; L; 1020
Fixation; L; 1200
Fixation; L; 980
Fixation; L; 990
Fixation; L; 1003
Message; Trial_0;
Message; ACC_1;
Message; RT_850;
Message; Stop_trial_0;
Message; Start_trial_1;
Fixation; L; 1023
Fixation; L; 1020
Fixation; L; 997
Fixation; L; 1123
Message; Trial_1;
Message; ACC_1;
Message; RT_920;
Message; Stop_trial_1;
Message; Strat_trial_2;
...
Knowing that, I never have the same number of "Fixation" line for each trial.
I want my data to be like that:
Trial_0; ACC_0; RT_850; Fixation; L; 1020
Trial_0; ACC_0; RT_850; Fixation; L; 1200
Trial_0; ACC_0; RT_850; Fixation; L; 980
Trial_0; ACC_0; RT_850; Fixation; L; 990
Trial_0; ACC_0; RT_850; Fixation; L; 1003
Trial_1; ACC_1; RT_920; Fixation; L; 1023
Trial_1; ACC_1; RT_920; Fixation; L; 1020
Trial_1; ACC_1; RT_920; Fixation; L; 997
Trial_1; ACC_1; RT_920; Fixation; L; 1123
...
As I'm not an experimented R user, I absolutely don't know how to do that (if it's possible). And as my data file contain over 1000000 lines, it cannot be done manually ...
Thanks in advance for your precious help !
Jibs.
The general approach is to split your lines into buckets of all the same trial, then pull out the metadata vs data lines, and make them into a dataframe (assuming that's what you ultimately want).
library(stringr)
library(purrr)
# You may be reading this in with `readLines` or similar,
# in which case you may not need to split on "\n" below
eye_text <-
"Event; Info; Pupil size
Message; Start_trial_0;
Fixation; L; 1020
Fixation; L; 1200
Fixation; L; 980
Fixation; L; 990
Fixation; L; 1003
Message; Trial_0;
Message; ACC_1;
Message; RT_850;
Message; Stop_trial_0;
Message; Start_trial_1;
Fixation; L; 1023
Fixation; L; 1020
Fixation; L; 997
Fixation; L; 1123
Message; Trial_1;
Message; ACC_1;
Message; RT_920;
Message; Stop_trial_1;
Message; Start_trial_2;" # Fixed typo?
# Depending how you read in the data, may already be a vector of lines
eye_lines <- str_split(eye_text, "\n")[[1]]
# Figure out where each trial starts
eye_starts <- cumsum(str_detect(eye_lines, "Start"))
Split the data
str_detect(eye_lines, "Start") gives you a vector of TRUE/FALSE indicating the start of each trial. cumsum coerces that to 1/0 and takes the running total. This way you end up with 0 0 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 3, or four groups from the sample text (the header, Trial 0, Trial 1, and one line of Trial 2).
eye_parser <- function(strings) {
message_indices <- str_detect(strings, "Message;") & !str_detect(strings, "Start|Stop")
messages <-
strings[message_indices] %>%
str_remove_all("Message; ") %>%
str_c(collapse = " ")
if (length(messages) == 0) return(NULL)
observations <- strings[!str_detect(strings, "Message")]
str_c(messages, observations, sep = " ")
}
Here we subset the strings twice: first we get all the Message; lines (but not the Start*/Stop* lines), then we get all the non-Message; lines.
For the messages, we strip out "Message; ", which leaves you with the metadata values (a vector of "Trial_0;", "ACC_1;", ... etc). Then you str_c those all back together into a single metadata line: "Trial_0; ACC_1; RT_850;".
At this point if the messages are all empty (like the header and partial trial), we just return NULL.
For the observations, we just take them as is. Then we str_c the messages and observations together, repeating messages in front of every observation line.
To use this function, we first split all your lines into the groups from above, then purrr::map the function over each group of strings. unlist takes it from a list of vectors to a single vector, and then str_split(..., "; ", simplify = T) breaks it out into a character matrix with columns. Finally as.data.frame makes it into a dataframe.
split(eye_lines, eye_starts) %>%
map(eye_parser) %>%
unlist(use.names = F) %>%
str_split("; ", simplify = T) %>%
as.data.frame()
V1 V2 V3 V4 V5 V6
1 Trial_0 ACC_1 RT_850 Fixation L 1020
2 Trial_0 ACC_1 RT_850 Fixation L 1200
3 Trial_0 ACC_1 RT_850 Fixation L 980
4 Trial_0 ACC_1 RT_850 Fixation L 990
5 Trial_0 ACC_1 RT_850 Fixation L 1003
6 Trial_1 ACC_1 RT_920 Fixation L 1023
7 Trial_1 ACC_1 RT_920 Fixation L 1020
8 Trial_1 ACC_1 RT_920 Fixation L 997
9 Trial_1 ACC_1 RT_920 Fixation L 1123
Caveats:
If your metadata isn't always exactly "Trial", "ACC", "RT" in that order, you'll probably want to extract those specifically. You can use the same code pattern I used for messages but for each of those individually. Then you can make sure they're present and in the correct order.
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 2L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2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L, 1L, 1L, 1L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("EFI",
"MSG"), class = "factor"), Info = structure(c(127L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 172L, 51L, 128L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
11L, 1L, 220L, 3L, 95L, 7L, 218L, 173L, 129L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 35L, 61L, 219L, 3L, 86L, 7L, 218L, 174L, 140L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 41L, 66L, 219L,
3L, 107L, 7L, 216L, 185L, 51L, 151L, 51L, 51L, 51L, 51L, 27L,
83L, 220L, 3L, 98L, 7L, 216L, 196L, 162L, 51L, 51L, 51L, 51L,
51L, 30L, 57L, 219L, 3L, 88L, 7L, 217L, 207L, 167L, 51L, 51L,
51L, 51L, 51L, 51L, 36L, 62L, 220L, 3L, 93L, 7L, 217L, 211L,
168L, 51L, 51L, 51L, 51L, 48L, 71L, 219L, 3L, 85L, 7L, 216L,
212L, 169L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 26L, 83L,
220L, 3L, 102L, 7L, 216L, 213L, 170L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 29L, 56L, 220L, 3L, 101L, 4L, 218L, 214L, 51L, 171L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 49L, 72L, 220L, 2L, 103L,
4L, 216L, 215L, 130L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 20L, 80L, 219L, 3L, 116L, 4L, 218L, 175L, 131L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 25L, 83L, 219L, 3L, 125L, 4L, 216L, 176L, 132L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 32L, 52L, 219L, 3L, 126L, 4L, 218L,
177L, 133L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 8L,
53L, 220L, 3L, 97L, 4L, 218L, 178L, 134L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 40L, 65L, 219L,
3L, 117L, 4L, 216L, 179L, 135L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 9L, 74L, 220L,
3L, 121L, 4L, 216L, 180L, 136L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 28L, 55L, 220L, 3L, 84L, 6L, 218L, 181L, 137L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 31L, 58L, 219L, 3L, 112L, 6L, 218L,
182L, 138L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 45L, 69L, 219L, 3L, 120L, 6L, 216L,
183L, 139L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 46L, 70L, 220L, 2L, 90L, 6L, 216L, 184L, 141L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 37L, 63L,
219L, 3L, 114L, 6L, 216L, 186L, 142L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 39L, 65L, 220L, 3L, 100L, 6L, 216L, 187L, 143L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 21L, 81L, 220L,
2L, 89L, 6L, 217L, 188L, 144L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 22L, 82L, 220L, 3L, 106L, 6L, 217L, 189L, 145L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 33L, 59L, 219L,
3L, 110L, 5L, 216L, 190L, 146L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 44L, 68L, 220L, 3L, 99L, 5L, 216L, 191L, 147L, 51L,
51L, 51L, 51L, 51L, 50L, 73L, 220L, 3L, 91L, 5L, 218L, 192L,
148L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 10L, 75L, 219L, 2L, 115L, 5L, 218L, 193L, 149L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 38L, 64L, 220L, 3L, 124L, 5L, 218L, 194L, 150L, 51L,
51L, 51L, 51L, 51L, 51L, 14L, 76L, 220L, 3L, 94L, 5L, 216L, 195L,
152L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 15L, 77L, 219L, 3L, 118L, 5L, 218L, 197L, 153L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 18L, 79L, 219L, 3L, 122L, 5L, 216L, 198L, 154L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 34L, 60L, 220L, 3L, 119L, 7L, 216L, 199L, 155L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 42L, 67L, 220L,
3L, 108L, 7L, 218L, 200L, 51L, 156L, 51L, 51L, 51L, 51L, 51L,
43L, 68L, 219L, 3L, 96L, 7L, 216L, 201L, 157L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 19L, 80L, 219L,
3L, 123L, 7L, 218L, 202L, 158L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 12L, 76L, 219L, 3L, 111L, 7L, 217L, 203L, 159L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 13L, 76L, 220L,
3L, 113L, 7L, 217L, 204L, 160L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 16L, 78L, 220L, 2L, 104L, 7L, 216L, 205L, 161L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 17L, 79L, 219L,
3L, 109L, 7L, 216L, 206L, 163L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 23L, 54L, 219L, 3L, 105L, 7L, 216L, 208L, 51L, 164L,
51L, 51L, 51L, 51L, 51L, 24L, 54L, 220L, 3L, 92L, 7L, 217L, 209L,
165L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 47L, 70L,
220L, 3L, 87L, 7L, 217L, 210L, 166L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L), .Label = c("36=32mod4", "correct_0",
"correct_1", "difficulty_Easy", "difficulty_Hard", "difficulty_Intermediate",
"difficulty_Very", "id_1058", "id_10975", "id_11207", "id_1129",
"id_12052", "id_12069", "id_12131", "id_12453", "id_13285", "id_13741",
"id_13817", "id_14467", "id_14596", "id_14907", "id_15262", "id_1544",
"id_1555", "id_15661", "id_15684", "id_15693", "id_1685", "id_2295",
"id_2479", "id_2820", "id_313", "id_3645", "id_3985", "id_4333",
"id_4541", "id_5249", "id_5426", "id_5684", "id_5756", "id_6016",
"id_6326", "id_7019", "id_7064", "id_7885", "id_8660", "id_8728",
"id_9028", "id_9263", "id_9419", "L", "modulo_26", "modulo_36",
"modulo_40", "modulo_42", "modulo_46", "modulo_47", "modulo_50",
"modulo_55", "modulo_57", "modulo_58", "modulo_59", "modulo_63",
"modulo_64", "modulo_65", "modulo_66", "modulo_68", "modulo_71",
"modulo_74", "modulo_77", "modulo_78", "modulo_79", "modulo_80",
"modulo_85", "modulo_86", "modulo_89", "modulo_90", "modulo_93",
"modulo_94", "modulo_96", "modulo_97", "modulo_98", "modulo_99",
"RT_10590", "RT_1367", "RT_14182", "RT_15412", "RT_1550", "RT_17151",
"RT_17302", "RT_1736", "RT_1891", "RT_2002", "RT_2227", "RT_2241",
"RT_2432", "RT_2510", "RT_2624", "RT_2660", "RT_2840", "RT_2956",
"RT_2984", "RT_3029", "RT_3154", "RT_3273", "RT_3283", "RT_3727",
"RT_3900", "RT_4493", "RT_4544", "RT_4840", "RT_5095", "RT_5368",
"RT_5583", "RT_5618", "RT_6009", "RT_6385", "RT_6423", "RT_6489",
"RT_6689", "RT_7471", "RT_7669", "RT_7697", "RT_8156", "RT_8752",
"RT_8784", "start_consigne", "start_trial_0", "start_trial_1",
"start_trial_10", "start_trial_11", "start_trial_12", "start_trial_13",
"start_trial_14", "start_trial_15", "start_trial_16", "start_trial_17",
"start_trial_18", "start_trial_19", "start_trial_2", "start_trial_20",
"start_trial_21", "start_trial_22", "start_trial_23", "start_trial_24",
"start_trial_25", "start_trial_26", "start_trial_27", "start_trial_28",
"start_trial_29", "start_trial_3", "start_trial_30", "start_trial_31",
"start_trial_32", "start_trial_33", "start_trial_34", "start_trial_35",
"start_trial_36", "start_trial_37", "start_trial_38", "start_trial_39",
"start_trial_4", "start_trial_40", "start_trial_41", "start_trial_42",
"start_trial_43", "start_trial_5", "start_trial_6", "start_trial_7",
"start_trial_8", "start_trial_9", "stop_consigne", "stop_trial_0",
"stop_trial_1", "stop_trial_10", "stop_trial_11", "stop_trial_12",
"stop_trial_13", "stop_trial_14", "stop_trial_15", "stop_trial_16",
"stop_trial_17", "stop_trial_18", "stop_trial_19", "stop_trial_2",
"stop_trial_20", "stop_trial_21", "stop_trial_22", "stop_trial_23",
"stop_trial_24", "stop_trial_25", "stop_trial_26", "stop_trial_27",
"stop_trial_28", "stop_trial_29", "stop_trial_3", "stop_trial_30",
"stop_trial_31", "stop_trial_32", "stop_trial_33", "stop_trial_34",
"stop_trial_35", "stop_trial_36", "stop_trial_37", "stop_trial_38",
"stop_trial_39", "stop_trial_4", "stop_trial_40", "stop_trial_41",
"stop_trial_42", "stop_trial_5", "stop_trial_6", "stop_trial_7",
"stop_trial_8", "stop_trial_9", "strat_1", "strat_2", "strat_4",
"val_0", "val_1"), class = "factor"), PS = c(NA, 904L, 906L,
838L, 805L, 789L, 797L, 876L, 924L, 928L, 964L, 957L, 935L, 861L,
834L, 856L, 846L, 811L, 825L, 869L, 904L, 936L, 969L, 965L, 1016L,
1018L, 1030L, 1015L, 999L, 987L, 1017L, 1064L, 1080L, 1061L,
1075L, 1046L, 1005L, 1014L, 1023L, 1040L, 1051L, 1046L, 1010L,
971L, 994L, 1071L, 1082L, 1120L, 1119L, 1044L, 1023L, 978L, 947L,
925L, 900L, 940L, NA, 963L, NA, 995L, 1013L, 1046L, 1005L, 1013L,
1043L, 1146L, 1205L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1306L,
1334L, 1285L, 1297L, 1257L, 1206L, 1206L, 1256L, 1252L, 1189L,
1254L, 1214L, 1203L, 1207L, 1263L, 1224L, 1235L, 1258L, 1210L,
1186L, 1201L, 1271L, 1246L, 1274L, 1337L, 1325L, 1551L, 1733L,
1812L, 1568L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1272L, 1218L,
1227L, 1165L, 1145L, 1192L, 1199L, 1208L, 1248L, 1280L, 1224L,
NA, NA, NA, NA, NA, NA, NA, NA, 1220L, NA, 1229L, 1250L, 1372L,
1102L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1141L, 1163L, 1146L,
1129L, 1190L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1182L, 1152L,
1134L, 1179L, 1178L, 1267L, NA, NA, NA, NA, NA, NA, NA, NA, NA,
1272L, 1186L, 1164L, 1173L, NA, NA, NA, NA, NA, NA, NA, NA, NA,
1265L, 1191L, 1109L, 1150L, 1125L, 1090L, 1139L, 1205L, NA, NA,
NA, NA, NA, NA, NA, NA, NA, 1277L, 1164L, 1122L, 1113L, 1115L,
1121L, 1168L, NA, NA, NA, NA, NA, NA, NA, NA, 1235L, NA, 1207L,
1164L, 1145L, 1177L, 1242L, 1224L, 1281L, NA, NA, NA, NA, NA,
NA, NA, NA, NA, 1234L, 1232L, 1204L, 1198L, 1108L, 1131L, 1220L,
1228L, 1227L, 1231L, 1299L, NA, NA, NA, NA, NA, NA, NA, NA, NA,
1211L, 1266L, 1294L, 1292L, 1129L, 1182L, 1175L, 1211L, 1233L,
1206L, 1185L, 1307L, 1209L, 1206L, NA, NA, NA, NA, NA, NA, NA,
NA, NA, 1245L, 1264L, 1283L, 1246L, 1290L, 1344L, 1311L, 1267L,
1201L, 1188L, 1164L, 1218L, 1188L, 1156L, 1144L, 1121L, 1145L,
1176L, 1155L, 1103L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1173L,
1223L, 1218L, 1170L, 1120L, 1084L, 1096L, 1092L, 985L, NA, NA,
NA, NA, NA, NA, NA, NA, NA, 1043L, 1092L, 1090L, 1126L, 1099L,
1125L, 1175L, 1099L, 1102L, 1188L, 1215L, 1225L, 1197L, 1268L,
NA, NA, NA, NA, NA, NA, NA, NA, NA, 1292L, 1338L, 1322L, 1284L,
1296L, 1273L, 1251L, 1216L, 1205L, 1200L, 1165L, 1097L, 1132L,
1209L, 1243L, 1295L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1288L,
1286L, 1243L, 1245L, 1215L, 1213L, 1215L, 1283L, 1280L, 1275L,
1334L, 1301L, 1205L, 1215L, 1267L, 1245L, 1203L, 1071L, 1113L,
1160L, 1211L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1243L, 1249L,
1268L, 1266L, 1299L, 1363L, 1215L, NA, NA, NA, NA, NA, NA, NA,
NA, NA, 938L, 831L, 929L, 999L, 1033L, 1090L, 1092L, 1094L, 1139L,
1144L, 1225L, 1203L, 1199L, 1261L, 1221L, 1230L, NA, NA, NA,
NA, NA, NA, NA, NA, NA, 1291L, 1308L, 1270L, 1250L, 1276L, 1226L,
1197L, 1201L, 1213L, 1195L, 1202L, 1201L, 1194L, 1192L, 1190L,
1206L, 1244L, 1203L, 1228L, 1239L, 1218L, 1218L, 1217L, 1218L,
1202L, 1224L, 1177L, 1134L, 1134L, 1152L, 1159L, 1162L, 1168L,
1107L, 1175L, 1200L, 1173L, 1203L, NA, NA, NA, NA, NA, NA, NA,
NA, NA, 1266L, 1278L, 1227L, 1188L, 1184L, 1178L, 1167L, 1194L,
1131L, 1166L, 1203L, 1211L, NA, NA, NA, NA, NA, NA, NA, NA, NA,
1223L, 1226L, 1218L, 1208L, 1142L, 1105L, 1122L, 1156L, NA, NA,
NA, NA, NA, NA, NA, NA, NA, 1118L, 1133L, 1150L, 1115L, 1070L,
1078L, 1145L, 1156L, 1175L, 1172L, 1129L, 1134L, 1089L, 1144L,
1171L, 1179L, 1195L, 1194L, 1231L, 1275L, 1250L, 1273L, 1268L,
1221L, 1245L, 1211L, 1195L, 1197L, 1194L, 1140L, 1168L, 1220L,
1197L, 1191L, 1240L, 1288L, NA, NA, NA, NA, NA, NA, NA, NA, NA,
1339L, 1327L, 1324L, 1320L, 1242L, 1231L, 1253L, 1255L, 1268L,
NA, NA, NA, NA, NA, NA, NA, NA, NA, 1297L, 1303L, 1282L, 1252L,
1200L, 1202L, 1191L, 1177L, 1220L, NA, NA, NA, NA, NA, NA, NA,
NA, NA, 1221L, 1224L, 1203L, 1162L, 1175L, 1187L, 1184L, 1165L,
NA, NA, NA, NA, NA, NA, NA, NA, NA, 1200L, 1225L, 1200L, 1205L,
1219L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1269L, 1209L, 1161L,
1171L, 1165L, 1140L, 1120L, 1127L, 1076L, 1081L, 1081L, 1114L,
NA, NA, NA, NA, NA, NA, NA, NA, NA, 1181L, 1186L, 1189L, 1200L,
1179L, 1186L, 1171L, 1134L, 1012L, 1004L, 1134L, 1090L, 1146L,
1222L, 1309L, 1334L, 1354L, NA, NA, NA, NA, NA, NA, NA, NA, NA,
1240L, 1121L, 1101L, 1104L, 1142L, 1157L, NA, NA, NA, NA, NA,
NA, NA, NA, NA, 1197L, 1264L, 1217L, 1181L, 1173L, 1160L, 1147L,
1174L, 1188L, 1183L, 1162L, 1188L, 1273L, NA, NA, NA, NA, NA,
NA, NA, NA, NA, 1303L, 1335L, 1346L, 1284L, 1227L, 1245L, 1295L,
1291L, 1284L, 1125L, 1176L, 1214L, 1206L, 1216L, 1232L, 1234L,
1268L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1326L, 1284L, 1265L,
1237L, 1206L, 1212L, 1197L, 1181L, 1216L, 1222L, 1205L, 1148L,
1163L, 1154L, 1138L, 1146L, NA, NA, NA, NA, NA, NA, NA, NA, NA,
1250L, 1229L, 1209L, 1199L, 1165L, 1191L, 1145L, 1130L, 1116L,
NA, NA, NA, NA, NA, NA, NA, NA, 1101L, NA, 1113L, 1126L, 1138L,
1160L, 1128L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1155L, 1132L,
1122L, 1146L, 1145L, 1146L, 1171L, 1103L, 1170L, 1136L, 1177L,
1108L, 1106L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1175L, 1192L,
1129L, 1163L, 1187L, 1177L, 1162L, 1184L, 1129L, NA, NA, NA,
NA, NA, NA, NA, NA, NA, 1221L, 1113L, 1089L, 1099L, 1022L, 995L,
947L, 1012L, 1065L, 1114L, NA, NA, NA, NA, NA, NA, NA, NA, NA,
1163L, 1094L, 1098L, 1139L, 1130L, 1117L, 1087L, 1084L, NA, NA,
NA, NA, NA, NA, NA, NA, NA, 1137L, 1145L, 1130L, 1105L, 1123L,
1112L, 1048L, 1055L, 1078L, 1147L, NA, NA, NA, NA, NA, NA, NA,
NA, NA, 1207L, 1164L, 1169L, 1188L, 1189L, 1140L, 1099L, 1178L,
NA, NA, NA, NA, NA, NA, NA, NA, 1208L, NA, 1258L, 1207L, 1158L,
1140L, 1099L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1123L, 1083L,
1043L, 1066L, 1082L, 1049L, 1040L, 1090L, 1112L, 1069L, 1079L,
1061L, 1029L, 1032L, 1046L, 1170L, 1197L, 956L, 941L, 1076L,
1136L, 1208L, 1213L, 1207L, 1186L, 1225L, 1222L, 1232L, 1169L,
1102L, 1144L, 1178L, 1218L, 1211L, 1229L, NA, NA, NA, NA, NA,
NA, NA, NA, NA, 1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mod2", "42=12mod6", "46=34mod6", "47=44mod2",
"50=20mod4", "55=20mod4", "57=15mod6", "58=52mod4", "59=57mod2",
"63=33mod4", "64=24mod8", "65=35mod6", "65=51mod6", "66=61mod6",
"68=26mod6", "71=21mod6", "71=31mod4", "74=53mod8", "77=53mod4",
"77=69mod2", "78=75mod4", "79=67mod6", "80=40mod4", "85=65mod4",
"86=50mod8", "89=32mod2", "89=35mod2", "89=49mod4", "90=50mod6",
"93=13mod8", "94=43mod4", "94=61mod4", "96=54mod4", "96=82mod6",
"97=75mod2", "98=76mod2", "99=85mod8", "99=91mod8", "99=93mod6"
), class = "factor")), class = "data.frame", row.names = c(NA,
-997L))
#Brian here is a sample of my dataset:
1 MSG start_consigne NA
2 EFI L 904
3 EFI L 906
4 EFI L 838
5 EFI L 805
6 EFI L 789
7 EFI L 797
8 EFI L 876
9 EFI L 924
10 EFI L 928
11 EFI L 964
12 EFI L 957
13 EFI L 935
14 EFI L 861
15 EFI L 834
16 EFI L 856
17 EFI L 846
18 EFI L 811
19 EFI L 825
20 EFI L 869
21 EFI L 904
22 EFI L 936
23 EFI L 969
24 EFI L 965
25 EFI L 1016
26 EFI L 1018
27 EFI L 1030
28 EFI L 1015
29 EFI L 999
30 EFI L 987
31 EFI L 1017
32 EFI L 1064
33 EFI L 1080
34 EFI L 1061
35 EFI L 1075
36 EFI L 1046
37 EFI L 1005
38 EFI L 1014
39 EFI L 1023
40 EFI L 1040
41 EFI L 1051
42 EFI L 1046
43 EFI L 1010
44 EFI L 971
45 EFI L 994
46 EFI L 1071
47 EFI L 1082
48 EFI L 1120
49 EFI L 1119
50 EFI L 1044
51 EFI L 1023
52 EFI L 978
53 EFI L 947
54 EFI L 925
55 EFI L 900
56 EFI L 940
57 MSG stop_consigne NA
58 EFI L 963
59 MSG start_trial_0 NA
60 EFI L 995
61 EFI L 1013
62 EFI L 1046
63 EFI L 1005
64 EFI L 1013
65 EFI L 1043
66 EFI L 1146
67 EFI L 1205
68 MSG id_1129 NA
69 MSG 36=32mod4 NA 36=32mod4
70 MSG val_1 NA
71 MSG correct_1 NA
72 MSG RT_2241 NA
73 MSG difficulty_Very NA
74 MSG strat_4 NA
75 MSG stop_trial_0 NA
76 MSG start_trial_1 NA
77 EFI L 1306
78 EFI L 1334
79 EFI L 1285
80 EFI L 1297
81 EFI L 1257
82 EFI L 1206
83 EFI L 1206
84 EFI L 1256
85 EFI L 1252
86 EFI L 1189
87 EFI L 1254
88 EFI L 1214
89 EFI L 1203
90 EFI L 1207
91 EFI L 1263
92 EFI L 1224
93 EFI L 1235
94 EFI L 1258
95 EFI L 1210
96 EFI L 1186
97 EFI L 1201
98 EFI L 1271
99 EFI L 1246
100 EFI L 1274
101 EFI L 1337
102 EFI L 1325
103 EFI L 1551
104 EFI L 1733
105 EFI L 1812
106 EFI L 1568
107 MSG id_4333 NA
108 MSG modulo_58 NA 58=52mod4
109 MSG val_0 NA
110 MSG correct_1 NA
111 MSG RT_14182 NA
112 MSG difficulty_Very NA
113 MSG strat_4 NA
114 MSG stop_trial_1 NA
115 MSG start_trial_2 NA
116 EFI L 1272
117 EFI L 1218
118 EFI L 1227
119 EFI L 1165
120 EFI L 1145
121 EFI L 1192
122 EFI L 1199
123 EFI L 1208
124 EFI L 1248
125 EFI L 1280
126 EFI L 1224
127 MSG id_6016 NA
128 MSG modulo_66 NA 66=61mod6
129 MSG val_0 NA
130 MSG correct_1 NA
131 MSG RT_3727 NA
132 MSG difficulty_Very NA
133 MSG strat_1 NA
134 MSG stop_trial_2 NA
135 EFI L 1220
136 MSG start_trial_3 NA
137 EFI L 1229
138 EFI L 1250
139 EFI L 1372
140 EFI L 1102
141 MSG id_15693 NA
142 MSG modulo_99 NA 99=93mod6
143 MSG val_1 NA
144 MSG correct_1 NA
145 MSG RT_2624 NA
146 MSG difficulty_Very NA
147 MSG strat_1 NA
148 MSG stop_trial_3 NA
149 MSG start_trial_4 NA````
structure(list(Event = structure(c(2L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1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, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 172L, 51L, 128L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
11L, 1L, 220L, 3L, 95L, 7L, 218L, 173L, 129L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 35L, 61L, 219L, 3L, 86L, 7L, 218L, 174L, 140L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 41L, 66L, 219L,
3L, 107L, 7L, 216L, 185L, 51L, 151L, 51L, 51L, 51L, 51L, 27L,
83L, 220L, 3L, 98L, 7L, 216L, 196L, 162L, 51L, 51L, 51L, 51L,
51L, 30L, 57L, 219L, 3L, 88L, 7L, 217L, 207L, 167L, 51L, 51L,
51L, 51L, 51L, 51L, 36L, 62L, 220L, 3L, 93L, 7L, 217L, 211L,
168L, 51L, 51L, 51L, 51L, 48L, 71L, 219L, 3L, 85L, 7L, 216L,
212L, 169L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 26L, 83L,
220L, 3L, 102L, 7L, 216L, 213L, 170L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 29L, 56L, 220L, 3L, 101L, 4L, 218L, 214L, 51L, 171L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 49L, 72L, 220L, 2L, 103L,
4L, 216L, 215L, 130L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 20L, 80L, 219L, 3L, 116L, 4L, 218L, 175L, 131L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 25L, 83L, 219L, 3L, 125L, 4L, 216L, 176L, 132L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 32L, 52L, 219L, 3L, 126L, 4L, 218L,
177L, 133L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 8L,
53L, 220L, 3L, 97L, 4L, 218L, 178L, 134L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 40L, 65L, 219L,
3L, 117L, 4L, 216L, 179L, 135L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 9L, 74L, 220L,
3L, 121L, 4L, 216L, 180L, 136L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 28L, 55L, 220L, 3L, 84L, 6L, 218L, 181L, 137L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 31L, 58L, 219L, 3L, 112L, 6L, 218L,
182L, 138L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 45L, 69L, 219L, 3L, 120L, 6L, 216L,
183L, 139L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 46L, 70L, 220L, 2L, 90L, 6L, 216L, 184L, 141L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 37L, 63L,
219L, 3L, 114L, 6L, 216L, 186L, 142L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 39L, 65L, 220L, 3L, 100L, 6L, 216L, 187L, 143L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 21L, 81L, 220L,
2L, 89L, 6L, 217L, 188L, 144L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 22L, 82L, 220L, 3L, 106L, 6L, 217L, 189L, 145L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 33L, 59L, 219L,
3L, 110L, 5L, 216L, 190L, 146L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 44L, 68L, 220L, 3L, 99L, 5L, 216L, 191L, 147L, 51L,
51L, 51L, 51L, 51L, 50L, 73L, 220L, 3L, 91L, 5L, 218L, 192L,
148L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 10L, 75L, 219L, 2L, 115L, 5L, 218L, 193L, 149L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 38L, 64L, 220L, 3L, 124L, 5L, 218L, 194L, 150L, 51L,
51L, 51L, 51L, 51L, 51L, 14L, 76L, 220L, 3L, 94L, 5L, 216L, 195L,
152L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 15L, 77L, 219L, 3L, 118L, 5L, 218L, 197L, 153L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 18L, 79L, 219L, 3L, 122L, 5L, 216L, 198L, 154L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 34L, 60L, 220L, 3L, 119L, 7L, 216L, 199L, 155L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 42L, 67L, 220L,
3L, 108L, 7L, 218L, 200L, 51L, 156L, 51L, 51L, 51L, 51L, 51L,
43L, 68L, 219L, 3L, 96L, 7L, 216L, 201L, 157L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 19L, 80L, 219L,
3L, 123L, 7L, 218L, 202L, 158L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 12L, 76L, 219L, 3L, 111L, 7L, 217L, 203L, 159L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 13L, 76L, 220L,
3L, 113L, 7L, 217L, 204L, 160L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 16L, 78L, 220L, 2L, 104L, 7L, 216L, 205L, 161L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 17L, 79L, 219L,
3L, 109L, 7L, 216L, 206L, 163L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 23L, 54L, 219L, 3L, 105L, 7L, 216L, 208L, 51L, 164L,
51L, 51L, 51L, 51L, 51L, 24L, 54L, 220L, 3L, 92L, 7L, 217L, 209L,
165L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 47L, 70L,
220L, 3L, 87L, 7L, 217L, 210L, 166L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L), .Label = c("36=32mod4", "correct_0",
"correct_1", "difficulty_Easy", "difficulty_Hard", "difficulty_Intermediate",
"difficulty_Very", "id_1058", "id_10975", "id_11207", "id_1129",
"id_12052", "id_12069", "id_12131", "id_12453", "id_13285", "id_13741",
"id_13817", "id_14467", "id_14596", "id_14907", "id_15262", "id_1544",
"id_1555", "id_15661", "id_15684", "id_15693", "id_1685", "id_2295",
"id_2479", "id_2820", "id_313", "id_3645", "id_3985", "id_4333",
"id_4541", "id_5249", "id_5426", "id_5684", "id_5756", "id_6016",
"id_6326", "id_7019", "id_7064", "id_7885", "id_8660", "id_8728",
"id_9028", "id_9263", "id_9419", "L", "modulo_26", "modulo_36",
"modulo_40", "modulo_42", "modulo_46", "modulo_47", "modulo_50",
"modulo_55", "modulo_57", "modulo_58", "modulo_59", "modulo_63",
"modulo_64", "modulo_65", "modulo_66", "modulo_68", "modulo_71",
"modulo_74", "modulo_77", "modulo_78", "modulo_79", "modulo_80",
"modulo_85", "modulo_86", "modulo_89", "modulo_90", "modulo_93",
"modulo_94", "modulo_96", "modulo_97", "modulo_98", "modulo_99",
"RT_10590", "RT_1367", "RT_14182", "RT_15412", "RT_1550", "RT_17151",
"RT_17302", "RT_1736", "RT_1891", "RT_2002", "RT_2227", "RT_2241",
"RT_2432", "RT_2510", "RT_2624", "RT_2660", "RT_2840", "RT_2956",
"RT_2984", "RT_3029", "RT_3154", "RT_3273", "RT_3283", "RT_3727",
"RT_3900", "RT_4493", "RT_4544", "RT_4840", "RT_5095", "RT_5368",
"RT_5583", "RT_5618", "RT_6009", "RT_6385", "RT_6423", "RT_6489",
"RT_6689", "RT_7471", "RT_7669", "RT_7697", "RT_8156", "RT_8752",
"RT_8784", "start_consigne", "start_trial_0", "start_trial_1",
"start_trial_10", "start_trial_11", "start_trial_12", "start_trial_13",
"start_trial_14", "start_trial_15", "start_trial_16", "start_trial_17",
"start_trial_18", "start_trial_19", "start_trial_2", "start_trial_20",
"start_trial_21", "start_trial_22", "start_trial_23", "start_trial_24",
"start_trial_25", "start_trial_26", "start_trial_27", "start_trial_28",
"start_trial_29", "start_trial_3", "start_trial_30", "start_trial_31",
"start_trial_32", "start_trial_33", "start_trial_34", "start_trial_35",
"start_trial_36", "start_trial_37", "start_trial_38", "start_trial_39",
"start_trial_4", "start_trial_40", "start_trial_41", "start_trial_42",
"start_trial_43", "start_trial_5", "start_trial_6", "start_trial_7",
"start_trial_8", "start_trial_9", "stop_consigne", "stop_trial_0",
"stop_trial_1", "stop_trial_10", "stop_trial_11", "stop_trial_12",
"stop_trial_13", "stop_trial_14", "stop_trial_15", "stop_trial_16",
"stop_trial_17", "stop_trial_18", "stop_trial_19", "stop_trial_2",
"stop_trial_20", "stop_trial_21", "stop_trial_22", "stop_trial_23",
"stop_trial_24", "stop_trial_25", "stop_trial_26", "stop_trial_27",
"stop_trial_28", "stop_trial_29", "stop_trial_3", "stop_trial_30",
"stop_trial_31", "stop_trial_32", "stop_trial_33", "stop_trial_34",
"stop_trial_35", "stop_trial_36", "stop_trial_37", "stop_trial_38",
"stop_trial_39", "stop_trial_4", "stop_trial_40", "stop_trial_41",
"stop_trial_42", "stop_trial_5", "stop_trial_6", "stop_trial_7",
"stop_trial_8", "stop_trial_9", "strat_1", "strat_2", "strat_4",
"val_0", "val_1"), class = "factor"), PS = c(NA, 904L, 906L,
838L, 805L, 789L, 797L, 876L, 924L, 928L, 964L, 957L, 935L, 861L,
834L, 856L, 846L, 811L, 825L, 869L, 904L, 936L, 969L, 965L, 1016L,
1018L, 1030L, 1015L, 999L, 987L, 1017L, 1064L, 1080L, 1061L,
1075L, 1046L, 1005L, 1014L, 1023L, 1040L, 1051L, 1046L, 1010L,
971L, 994L, 1071L, 1082L, 1120L, 1119L, 1044L, 1023L, 978L, 947L,
925L, 900L, 940L, NA, 963L, NA, 995L, 1013L, 1046L, 1005L, 1013L,
1043L, 1146L, 1205L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1306L,
1334L, 1285L, 1297L, 1257L, 1206L, 1206L, 1256L, 1252L, 1189L,
1254L, 1214L, 1203L, 1207L, 1263L, 1224L, 1235L, 1258L, 1210L,
1186L, 1201L, 1271L, 1246L, 1274L, 1337L, 1325L, 1551L, 1733L,
1812L, 1568L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1272L, 1218L,
1227L, 1165L, 1145L, 1192L, 1199L, 1208L, 1248L, 1280L, 1224L,
NA, NA, NA, NA, NA, NA, NA, NA, 1220L, NA, 1229L, 1250L, 1372L,
1102L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1141L, 1163L, 1146L,
1129L, 1190L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1182L, 1152L,
1134L, 1179L, 1178L, 1267L, NA, NA, NA, NA, NA, NA, NA, NA, NA,
1272L, 1186L, 1164L, 1173L, NA, NA, NA, NA, NA, NA, NA, NA, NA,
1265L, 1191L, 1109L, 1150L, 1125L, 1090L, 1139L, 1205L, NA, NA,
NA, NA, NA, NA, NA, NA, NA, 1277L, 1164L, 1122L, 1113L, 1115L,
1121L, 1168L, NA, NA, NA, NA, NA, NA, NA, NA, 1235L, NA, 1207L,
1164L, 1145L, 1177L, 1242L, 1224L, 1281L, NA, NA, NA, NA, NA,
NA, NA, NA, NA, 1234L, 1232L, 1204L, 1198L, 1108L, 1131L, 1220L,
1228L, 1227L, 1231L, 1299L, NA, NA, NA, NA, NA, NA, NA, NA, NA,
1211L, 1266L, 1294L, 1292L, 1129L, 1182L, 1175L, 1211L, 1233L,
1206L, 1185L, 1307L, 1209L, 1206L, NA, NA, NA, NA, NA, NA, NA,
NA, NA, 1245L, 1264L, 1283L, 1246L, 1290L, 1344L, 1311L, 1267L,
1201L, 1188L, 1164L, 1218L, 1188L, 1156L, 1144L, 1121L, 1145L,
1176L, 1155L, 1103L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1173L,
1223L, 1218L, 1170L, 1120L, 1084L, 1096L, 1092L, 985L, NA, NA,
NA, NA, NA, NA, NA, NA, NA, 1043L, 1092L, 1090L, 1126L, 1099L,
1125L, 1175L, 1099L, 1102L, 1188L, 1215L, 1225L, 1197L, 1268L,
NA, NA, NA, NA, NA, NA, NA, NA, NA, 1292L, 1338L, 1322L, 1284L,
1296L, 1273L, 1251L, 1216L, 1205L, 1200L, 1165L, 1097L, 1132L,
1209L, 1243L, 1295L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1288L,
1286L, 1243L, 1245L, 1215L, 1213L, 1215L, 1283L, 1280L, 1275L,
1334L, 1301L, 1205L, 1215L, 1267L, 1245L, 1203L, 1071L, 1113L,
1160L, 1211L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1243L, 1249L,
1268L, 1266L, 1299L, 1363L, 1215L, NA, NA, NA, NA, NA, NA, NA,
NA, NA, 938L, 831L, 929L, 999L, 1033L, 1090L, 1092L, 1094L, 1139L,
1144L, 1225L, 1203L, 1199L, 1261L, 1221L, 1230L, NA, NA, NA,
NA, NA, NA, NA, NA, NA, 1291L, 1308L, 1270L, 1250L, 1276L, 1226L,
1197L, 1201L, 1213L, 1195L, 1202L, 1201L, 1194L, 1192L, 1190L,
1206L, 1244L, 1203L, 1228L, 1239L, 1218L, 1218L, 1217L, 1218L,
1202L, 1224L, 1177L, 1134L, 1134L, 1152L, 1159L, 1162L, 1168L,
1107L, 1175L, 1200L, 1173L, 1203L, NA, NA, NA, NA, NA, NA, NA,
NA, NA, 1266L, 1278L, 1227L, 1188L, 1184L, 1178L, 1167L, 1194L,
1131L, 1166L, 1203L, 1211L, NA, NA, NA, NA, NA, NA, NA, NA, NA,
1223L, 1226L, 1218L, 1208L, 1142L, 1105L, 1122L, 1156L, NA, NA,
NA, NA, NA, NA, NA, NA, NA, 1118L, 1133L, 1150L, 1115L, 1070L,
1078L, 1145L, 1156L, 1175L, 1172L, 1129L, 1134L, 1089L, 1144L,
1171L, 1179L, 1195L, 1194L, 1231L, 1275L, 1250L, 1273L, 1268L,
1221L, 1245L, 1211L, 1195L, 1197L, 1194L, 1140L, 1168L, 1220L,
1197L, 1191L, 1240L, 1288L, NA, NA, NA, NA, NA, NA, NA, NA, NA,
1339L, 1327L, 1324L, 1320L, 1242L, 1231L, 1253L, 1255L, 1268L,
NA, NA, NA, NA, NA, NA, NA, NA, NA, 1297L, 1303L, 1282L, 1252L,
1200L, 1202L, 1191L, 1177L, 1220L, NA, NA, NA, NA, NA, NA, NA,
NA, NA, 1221L, 1224L, 1203L, 1162L, 1175L, 1187L, 1184L, 1165L,
NA, NA, NA, NA, NA, NA, NA, NA, NA, 1200L, 1225L, 1200L, 1205L,
1219L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1269L, 1209L, 1161L,
1171L, 1165L, 1140L, 1120L, 1127L, 1076L, 1081L, 1081L, 1114L,
NA, NA, NA, NA, NA, NA, NA, NA, NA, 1181L, 1186L, 1189L, 1200L,
1179L, 1186L, 1171L, 1134L, 1012L, 1004L, 1134L, 1090L, 1146L,
1222L, 1309L, 1334L, 1354L, NA, NA, NA, NA, NA, NA, NA, NA, NA,
1240L, 1121L, 1101L, 1104L, 1142L, 1157L, NA, NA, NA, NA, NA,
NA, NA, NA, NA, 1197L, 1264L, 1217L, 1181L, 1173L, 1160L, 1147L,
1174L, 1188L, 1183L, 1162L, 1188L, 1273L, NA, NA, NA, NA, NA,
NA, NA, NA, NA, 1303L, 1335L, 1346L, 1284L, 1227L, 1245L, 1295L,
1291L, 1284L, 1125L, 1176L, 1214L, 1206L, 1216L, 1232L, 1234L,
1268L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1326L, 1284L, 1265L,
1237L, 1206L, 1212L, 1197L, 1181L, 1216L, 1222L, 1205L, 1148L,
1163L, 1154L, 1138L, 1146L, NA, NA, NA, NA, NA, NA, NA, NA, NA,
1250L, 1229L, 1209L, 1199L, 1165L, 1191L, 1145L, 1130L, 1116L,
NA, NA, NA, NA, NA, NA, NA, NA, 1101L, NA, 1113L, 1126L, 1138L,
1160L, 1128L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1155L, 1132L,
1122L, 1146L, 1145L, 1146L, 1171L, 1103L, 1170L, 1136L, 1177L,
1108L, 1106L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1175L, 1192L,
1129L, 1163L, 1187L, 1177L, 1162L, 1184L, 1129L, NA, NA, NA,
NA, NA, NA, NA, NA, NA, 1221L, 1113L, 1089L, 1099L, 1022L, 995L,
947L, 1012L, 1065L, 1114L, NA, NA, NA, NA, NA, NA, NA, NA, NA,
1163L, 1094L, 1098L, 1139L, 1130L, 1117L, 1087L, 1084L, NA, NA,
NA, NA, NA, NA, NA, NA, NA, 1137L, 1145L, 1130L, 1105L, 1123L,
1112L, 1048L, 1055L, 1078L, 1147L, NA, NA, NA, NA, NA, NA, NA,
NA, NA, 1207L, 1164L, 1169L, 1188L, 1189L, 1140L, 1099L, 1178L,
NA, NA, NA, NA, NA, NA, NA, NA, 1208L, NA, 1258L, 1207L, 1158L,
1140L, 1099L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1123L, 1083L,
1043L, 1066L, 1082L, 1049L, 1040L, 1090L, 1112L, 1069L, 1079L,
1061L, 1029L, 1032L, 1046L, 1170L, 1197L, 956L, 941L, 1076L,
1136L, 1208L, 1213L, 1207L, 1186L, 1225L, 1222L, 1232L, 1169L,
1102L, 1144L, 1178L, 1218L, 1211L, 1229L, NA, NA, NA, NA, NA,
NA, NA, NA, NA, 1255L, 1260L, 1236L, 1271L, 1312L, 1346L, 1272L,
1171L, 1192L, 1235L, 1296L), Modulo = structure(c(1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 4L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 13L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1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L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 36L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 5L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 6L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 25L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L), .Label = c(" ", "26=12mod6", "36=16mod4", "36=32mod4",
"40=33mod8", "40=36mod2", "42=12mod6", "46=34mod6", "47=44mod2",
"50=20mod4", "55=20mod4", "57=15mod6", "58=52mod4", "59=57mod2",
"63=33mod4", "64=24mod8", "65=35mod6", "65=51mod6", "66=61mod6",
"68=26mod6", "71=21mod6", "71=31mod4", "74=53mod8", "77=53mod4",
"77=69mod2", "78=75mod4", "79=67mod6", "80=40mod4", "85=65mod4",
"86=50mod8", "89=32mod2", "89=35mod2", "89=49mod4", "90=50mod6",
"93=13mod8", "94=43mod4", "94=61mod4", "96=54mod4", "96=82mod6",
"97=75mod2", "98=76mod2", "99=85mod8", "99=91mod8", "99=93mod6"
), class = "factor")), class = "data.frame", row.names = c(NA,
-997L))````
Brian has offered a perfect approach to your problem. My approach was slightly different, yet with similar results. For the sake of completion and/or variety i am going to post it though.
My way of thinking is as follows:
You first read in your file and pass it into a dataframe df
library(dplyr) # load the libraries we are going to be using first
library(tidyr)
library(zoo)
df <- read.csv('~/Desktop/test', sep = ';', header = T) # I named your .txt file test here and put it on my Desktop
>df
Event Info Pupil.size
1 Message Start_trial_0 NA
2 Fixation L 1020
3 Fixation L 1200
4 Fixation L 980
5 Fixation L 990
6 Fixation L 1003
7 Message Trial_0 NA
8 Message ACC_0 NA
9 Message RT_850 NA
10 Message Stop_trial_0 NA
11 Message Start_trial_1 NA
12 Fixation L 1023
13 Fixation L 1020
14 Fixation L 997
15 Fixation L 1123
16 Message Trial_1 NA
17 Message ACC_1 NA
18 Message RT_920 NA
19 Message Stop_trial_1 NA
20 Message Strat_trial_2 NA
Then we create a new column, named trial where for every row on Info that has the trial info (the Start and Stop in this case), we pass the corresponding trial, otherwise we fill with NA, as such:
Option 1 (original file data):
df <- df %>% mutate(trial=ifelse(Event=='Message'&grepl('trial', df$Info), gsub('.*_(trial_\\d)$', '\\1', df$Info), NA))
Event Info Pupil.size trial
1 Message Start_trial_0 NA trial_0
2 Fixation L 1020 <NA>
3 Fixation L 1200 <NA>
4 Fixation L 980 <NA>
5 Fixation L 990 <NA>
6 Fixation L 1003 <NA>
7 Message Trial_0 NA <NA>
8 Message ACC_0 NA <NA>
9 Message RT_850 NA <NA>
10 Message Stop_trial_0 NA trial_0
11 Message Start_trial_1 NA trial_1
12 Fixation L 1023 <NA>
13 Fixation L 1020 <NA>
14 Fixation L 997 <NA>
15 Fixation L 1123 <NA>
16 Message Trial_1 NA <NA>
17 Message ACC_1 NA <NA>
18 Message RT_920 NA <NA>
19 Message Stop_trial_1 NA trial_1
20 Message Strat_trial_2 NA trial_2
Option 2 (new input file - keep in mind this preserves the in-between trial data that you might want to get rid of):
df <- df %>% mutate(trial=ifelse(Event=='MSG'&grepl('trial', df$Info), gsub('.*_(trial_\\d)$', '\\1', df$Info),
ifelse(Event=='MSG'&grepl('consigne', df$Info), gsub('.*_(consigne)$', '\\1', df$Info),
NA)))
I am filling with NA since on the next step we want to replace NAs with the earliest previous non NA value (thus assigning the correct trial on every row between the Start-Stop). This can be done with na.locf from the package zoo.
df$trial <- na.locf(df$trial)
> df
Event Info Pupil.size trial
1 Message Start_trial_0 NA trial_0
2 Fixation L 1020 trial_0
3 Fixation L 1200 trial_0
4 Fixation L 980 trial_0
5 Fixation L 990 trial_0
6 Fixation L 1003 trial_0
7 Message Trial_0 NA trial_0
8 Message ACC_0 NA trial_0
9 Message RT_850 NA trial_0
10 Message Stop_trial_0 NA trial_0
11 Message Start_trial_1 NA trial_1
12 Fixation L 1023 trial_1
13 Fixation L 1020 trial_1
14 Fixation L 997 trial_1
15 Fixation L 1123 trial_1
16 Message Trial_1 NA trial_1
17 Message ACC_1 NA trial_1
18 Message RT_920 NA trial_1
19 Message Stop_trial_1 NA trial_1
20 Message Strat_trial_2 NA trial_2
We can now get rid of the rows with Trial "metadata" on the Info column.
df <- df %>% filter(!grepl('[T,t]rial', df$Info))
Next, we need the final "metadata" information per trial, namely ACC and RT information. These information are all within the Info column so we have to pull them out somehow. To do that first, we create two new columns named ACC and RT.
df <- df %>% mutate(ACC=ifelse(grepl('ACC', df$Info), as.character(df$Info), NA),
RT=ifelse(grepl('RT', df$Info), as.character(df$Info), NA))
> df
Event Info Pupil.size trial ACC RT
1 Fixation L 1020 trial_0 <NA> <NA>
2 Fixation L 1200 trial_0 <NA> <NA>
3 Fixation L 980 trial_0 <NA> <NA>
4 Fixation L 990 trial_0 <NA> <NA>
5 Fixation L 1003 trial_0 <NA> <NA>
6 Message ACC_0 NA trial_0 ACC_0 <NA>
7 Message RT_850 NA trial_0 <NA> RT_850
8 Fixation L 1023 trial_1 <NA> <NA>
9 Fixation L 1020 trial_1 <NA> <NA>
10 Fixation L 997 trial_1 <NA> <NA>
11 Fixation L 1123 trial_1 <NA> <NA>
12 Message ACC_1 NA trial_1 ACC_1 <NA>
13 Message RT_920 NA trial_1 <NA> RT_920
We also need to make sure which ACC and RT attributes correspond to each trial. For that purpose we create two new small dataframes via dplyr that give us all the ACC and RT info.
infoACC <- df %>% group_by(trial, Info) %>% summarize() %>% filter(grepl('ACC', Info))
> infoACC
# A tibble: 2 x 2
# Groups: trial [2]
trial Info
<chr> <fct>
1 trial_0 " ACC_0"
2 trial_1 " ACC_1"
infoRT <- df %>% group_by(trial, Info) %>% summarize() %>% filter(grepl('RT', Info))
> infoRT
# A tibble: 2 x 2
# Groups: trial [2]
trial Info
<chr> <fct>
1 trial_0 " RT_850"
2 trial_1 " RT_920"
Then it's just a matter of joining our df and the two new dataframes to get the ACC and RT info in, dropping the additional columns and left-over rows (Message rows)
df <- left_join(left_join(df, infoACC, by='trial'), infoRT, by='trial') %>% select(-ACC, -RT) %>% filter(!Event=='Message')
And wrap this up with fixing up the column names.
colnames(df) <- c('Event', 'Info', 'Pupil.size', 'Trial', 'ACC', 'RT')
> df
Event Info Pupil.size Trial ACC RT
1 Fixation L 1020 trial_0 ACC_0 RT_850
2 Fixation L 1200 trial_0 ACC_0 RT_850
3 Fixation L 980 trial_0 ACC_0 RT_850
4 Fixation L 990 trial_0 ACC_0 RT_850
5 Fixation L 1003 trial_0 ACC_0 RT_850
6 Fixation L 1023 trial_1 ACC_1 RT_920
7 Fixation L 1020 trial_1 ACC_1 RT_920
8 Fixation L 997 trial_1 ACC_1 RT_920
9 Fixation L 1123 trial_1 ACC_1 RT_920
You can now save this as a new .csv or keep it as a dataframe for further operations in R.
I admit its a bit of a more complicated solution, but i wanted to offer my thinking process hoping to show you that there are many ways to approach your problems in R and you can tackle your questions in a stepwise manner.
Hope this helps

R - ggplot2 extrapolated regression lines in linear region

I have the following data frame (attached). I have plotted CR vs A for various Collimator / Head combinations.
(p <- ggplot(df,aes(x=A,y=CR,col=Head))+geom_point()+geom_line() +facet_grid(Collimator~Head, scales="fixed")+scale_x_continuous("Activity [MBq]", expand = c(0,0))+ylim(0,80000)+ ylab("Count Rate [cps]") + theme_bw()+theme(legend.position = "none"))
In an ideal world the above plot would be linear. In reality CR will begin to fall off with A due to increased system deadtime. What I would like to add to each facet is a straight line fit which passes through the first 2 data points only - this is before dead time kicks in.
Is there a simple way to do this in ggplot2. Can I use geom_smooth(method = "lm") with some additional options?
structure(list(A0 = c(76L, 274L, 786L, 1060L, 1294L, 2092L, 2639L,
3437L, 4223L, 76L, 274L, 786L, 1060L, 1294L, 2092L, 2639L, 3437L,
4223L, 76L, 274L, 786L, 1060L, 1294L, 2092L, 2639L, 3437L, 4223L,
76L, 274L, 786L, 1060L, 1294L, 2092L, 2639L, 3437L, 4223L, 76L,
274L, 786L, 1060L, 1294L, 2092L, 2639L, 3437L, 4223L, 76L, 274L,
786L, 1060L, 1294L, 2092L, 2639L, 3437L, 4223L), T = c(85L, 87L,
88L, 89L, 89L, 90L, 91L, 92L, 93L, 97L, 98L, 99L, 100L, 101L,
102L, 103L, 103L, 104L, 306L, 308L, 310L, 311L, 313L, 315L, 316L,
317L, 321L, 328L, 330L, 331L, 332L, 336L, 338L, 340L, 341L, 342L,
352L, 354L, 357L, 358L, 361L, 363L, 364L, 366L, 368L, 376L, 378L,
379L, 380L, 385L, 386L, 388L, 389L, 390L), A = c(64.8860944957,
233.0628375794, 667.3247389509, 898.2821229937, 1096.5821388243,
1769.5416286837, 2228.0796200189, 2896.4301555482, 3552.1951906822,
63.4538798403, 228.3428223318, 653.8100019998, 880.0900106808,
1072.3775535078, 1730.4829756141, 2178.8997717016, 2837.7713207042,
3480.2557273313, 43.0160516527, 154.5083447781, 441.5789350636,
594.4069507774, 722.9307781622, 1164.4170158664, 1466.1502053416,
1905.9469999005, 2324.4554021136, 41.2913626085, 148.3134747414,
424.6633733747, 571.6370071823, 692.6559941892, 1115.653739112,
1402.1405840581, 1822.7365994889, 2235.4125025879, 39.4886520314,
141.8383609947, 404.6153215597, 544.6504360348, 661.1848647194,
1064.9635212237, 1340.925513839, 1739.9197611259, 2129.880289335,
37.7646447282, 135.6459396877, 388.3926422248, 522.8131775262,
632.318659446, 1020.3651426265, 1282.3829893435, 1667.0556688926,
2044.484697239), Counts = c(102830L, 328231L, 784020L, 1010212L,
1160531L, 1582051L, 1760850L, 1888034L, 1897347L, 99780L, 317952L,
749548L, 965314L, 1106831L, 1488386L, 1672990L, 1793667L, 1789803L,
129507L, 453800L, 1053106L, 1327867L, 1473197L, 1900706L, 2075742L,
1991265L, 1756820L, 121230L, 424329L, 994864L, 1237568L, 1374478L,
1734922L, 1921046L, 1878514L, 1664225L, 213389L, 712467L, 1498082L,
1777791L, 1882367L, 1824631L, 1525162L, 1250229L, 1072038L, 193591L,
651249L, 1354850L, 1594421L, 1653835L, 1669993L, 1436444L, 1144518L,
1015859L), CR = c(3428L, 10941L, 26134L, 33674L, 38684L, 52735L,
58695L, 62934L, 63245L, 3326L, 10598L, 24985L, 32177L, 36894L,
49613L, 55766L, 59789L, 59660L, 4317L, 15127L, 35104L, 44262L,
49107L, 63357L, 69191L, 66376L, 58561L, 4041L, 14144L, 33162L,
41252L, 45816L, 57831L, 64035L, 62617L, 55474L, 7113L, 23749L,
49936L, 59260L, 62746L, 60821L, 50839L, 41674L, 35735L, 6453L,
21708L, 45162L, 53147L, 55128L, 55666L, 47881L, 38151L, 33862L
), Head = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("H1",
"H2"), class = "factor"), Collimator = structure(c(1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L), .Label = c("HRGP", "LEGP", "LEHS"), class = "factor")), .Names = c("A0",
"T", "A", "Counts", "CR", "Head", "Collimator"), row.names = c(NA,
-54L), class = "data.frame")
This should do it:
library(ggplot2)
(p <- ggplot(df,aes(x=A,y=CR,col=Head))+
geom_point()+geom_line() +
facet_grid(Collimator~Head, scales="fixed")+
scale_x_continuous("Activity [MBq]",
expand = c(0,0))+ylim(0,80000)+
ylab("Count Rate [cps]") + theme_bw()+theme(legend.position = "none"))
library(plyr)
subdf <- ddply(df,c("Collimator","Head"),
function(x) x[1:2,])
p + geom_smooth(method="lm",data=subdf,colour="gray",se=FALSE,
fullrange=TRUE)
One approach would be to make new data frame that contains pnly first two values for each combination of Collimator and Head. Then calulate slope and intercept values for those two values and use them in geom_abline() to draw straight lines.
library(plyr)
#subset only firt two values
df2<-ddply(df,.(Collimator,Head),function(x) head(x,2))
head(df2)
A0 T A Counts CR Head Collimator
1 76 97 63.45388 99780 3326 H1 HRGP
2 274 98 228.34282 317952 10598 H1 HRGP
3 76 85 64.88609 102830 3428 H2 HRGP
4 274 87 233.06284 328231 10941 H2 HRGP
5 76 328 41.29136 121230 4041 H1 LEGP
6 274 330 148.31347 424329 14144 H1 LEGP
#caclulate slope and intercept
df3<-ddply(df2,.(Collimator,Head),summarise, int=coefficients(lm(CR~A))[1],
slop=coefficients(lm(CR~A))[2])
df3
Collimator Head int slop
1 HRGP H1 527.5309 44.10241
2 HRGP H2 529.3279 44.67324
3 LEGP H1 143.0519 94.40105
4 LEGP H2 146.2766 96.95737
5 LEHS H1 567.3029 155.85205
6 LEHS H2 694.4843 162.54077
ggplot(df,aes(x=A,y=CR,col=Head))+geom_point()+geom_line() +
facet_grid(Collimator~Head, scales="fixed") +
scale_x_continuous("Activity [MBq]", expand = c(0,0))+ ylim(0,80000) +
ylab("Count Rate [cps]") +
theme_bw()+theme(legend.position = "none")+
geom_abline(data=df3,aes(intercept=int,slope=slop,color=Head))

How can I add missing sequence values?

I have a data frame like this:
structure(list(x = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L,
11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L,
24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, 36L,
37L, 38L, 39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L, 47L, 48L, 49L,
50L, 51L, 52L, 53L, 54L, 55L, 56L, 57L, 58L, 59L, 60L, 61L, 62L,
63L, 64L, 65L, 66L, 67L, 68L, 69L, 70L, 71L, 72L, 73L, 74L, 75L,
76L, 77L, 78L, 79L, 80L, 81L, 82L, 83L, 84L, 85L, 86L, 87L, 88L,
89L, 90L, 91L, 92L, 93L, 94L, 95L, 96L, 97L, 98L, 99L, 100L,
101L, 102L, 103L, 104L, 105L, 106L, 107L, 108L, 109L, 110L, 112L,
113L, 114L, 115L, 116L, 117L, 118L, 119L, 120L, 121L, 123L, 124L,
125L, 127L, 128L, 129L, 130L, 132L, 133L, 134L, 135L, 136L, 137L,
138L, 139L, 140L, 141L, 142L, 143L, 145L, 146L, 147L, 148L, 149L,
150L, 151L, 152L, 153L, 154L, 155L, 158L, 160L, 163L, 164L, 166L,
167L, 169L, 170L, 173L, 174L, 178L, 179L, 181L, 182L, 183L, 186L,
187L, 191L, 192L, 193L, 194L, 197L, 198L, 200L, 205L, 208L, 209L,
213L, 214L, 216L, 217L, 220L, 222L, 223L, 225L, 229L, 233L, 235L,
237L, 242L, 243L, 244L, 251L, 253L, 254L, 255L, 261L, 262L, 263L,
264L, 267L, 268L, 269L, 270L, 276L, 281L, 282L, 284L, 285L, 287L,
289L, 293L, 295L, 297L, 299L, 301L, 306L, 308L, 315L, 317L, 318L,
320L, 327L, 330L, 336L, 337L, 345L, 346L, 355L, 359L, 376L, 377L,
379L, 384L, 387L, 388L, 402L, 405L, 408L, 415L, 420L, 421L, 427L,
428L, 429L, 430L, 437L, 438L, 439L, 440L, 446L, 448L, 453L, 456L,
469L, 472L, 476L, 478L, 481L, 483L, 486L, 487L, 488L, 497L, 500L,
502L, 504L, 507L, 512L, 525L, 530L, 531L, 543L, 546L, 550L, 578L,
581L, 598L, 601L, 680L, 689L, 693L, 712L, 728L, 746L, 768L, 790L,
794L, 840L, 851L, 861L, 928L, 969L, 1010L, 1180L, 1698L), freq = c(29186L,
12276L, 5851L, 3938L, 3133L, 1894L, 1157L, 820L, 597L, 481L,
398L, 297L, 269L, 251L, 175L, 176L, 153L, 130L, 117L, 108L, 93L,
83L, 58L, 84L, 60L, 43L, 59L, 51L, 57L, 53L, 38L, 38L, 32L, 35L,
28L, 27L, 29L, 22L, 24L, 29L, 30L, 23L, 26L, 19L, 19L, 25L, 14L,
22L, 16L, 12L, 15L, 14L, 11L, 13L, 18L, 10L, 17L, 20L, 7L, 9L,
2L, 8L, 12L, 8L, 7L, 10L, 10L, 9L, 6L, 6L, 9L, 5L, 11L, 4L, 5L,
5L, 10L, 4L, 6L, 1L, 4L, 7L, 3L, 4L, 3L, 2L, 3L, 5L, 7L, 2L,
2L, 3L, 2L, 4L, 7L, 1L, 3L, 5L, 5L, 3L, 5L, 2L, 2L, 2L, 3L, 2L,
5L, 7L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 2L, 1L, 3L, 2L, 2L, 1L,
3L, 4L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 1L, 4L, 3L, 1L, 2L, 2L, 1L,
1L, 1L, 1L, 2L, 3L, 1L, 1L, 3L, 2L, 1L, 1L, 1L, 4L, 4L, 1L, 2L,
2L, 4L, 2L, 1L, 1L, 1L, 1L, 3L, 1L, 1L, 2L, 3L, 1L, 1L, 1L, 1L,
3L, 2L, 1L, 3L, 1L, 3L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L,
2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 3L, 2L, 1L, 1L, 2L, 1L, 1L,
2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L,
1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 4L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L)), .Names = c("x",
"freq"), row.names = c(NA, -296L), class = "data.frame")
After the x value of 130, there are missing values. Is there a way I make this a continuous data frame in increments of 1 i.e. from 1 to 1698, populate the entire list and set the elements that do not have a value here as 0? What I mean is:
1,2
4,5
5,7
should be converted to:
1,2
2,0
3,0
4,5
5,7
Any suggestions?
You can also use merge (assuming your data is strored in l):
l <- merge(l,data.frame(x = 1:1698),all = TRUE,by = "x")
l$freq[is.na(l$freq)] <- 0
I'd create a data set of values that aren't covered by column x and then create a dataframe of those values and assign 0 to the freq of all of these x values. Then rbind and order by x.
#I called your data dat
y <- 1:max(dat$x)
dat2 <- data.frame(x=y[!y%in%dat$x], freq=0)
dat3 <- rbind(dat, dat2)
dat4 <- dat3[order(dat3$x), ] #could stop here
rownames(dat4) <- NULL #but I hate non sequential row names
dat4

Resources