In RStudio Scale in cdata creates Nan in one column - scale

The data
cbinded
TRH_ng.l_x TSH_mU.l_x TT4_nmol.l_x FT4_pmol.l_x TT3_nmol.l_x
200000 2550.1468 1.3905 94.9976 13.7658 4.1902
200001 1772.8503 1.3940 94.9983 13.7659 4.1902
200002 79.5624 1.3818 94.9989 13.7660 4.1902
200003 2920.7433 1.3510 94.9994 13.7660 4.1902
200004 810.1929 1.3317 94.9999 13.7661 4.1903
200005 3689.8969 1.3082 95.0003 13.7662 4.1903
200006 3801.8623 1.2929 95.0005 13.7662 4.1903
200007 3292.5112 1.3060 95.0007 13.7662 4.1903
200008 3105.6381 1.3386 95.0007 13.7662 4.1903
200009 2050.4685 1.3322 95.0007 13.7662 4.1903
200010 2381.0548 1.3095 95.0007 13.7662 4.1903
200011 1532.4462 1.3041 95.0009 13.7662 4.1903
FT3_pmol.l_x TRH_ng.l TSH_mU.l TT4_nmol.l FT4_pmol.l TT3_nmol.l
200000 6.9721 805.7943 2.0603 128.5132 18.6224 3.3824
200001 6.9721 819.0070 2.0228 128.5135 18.6224 3.3824
200002 6.9721 625.0992 2.0073 128.5138 18.6225 3.3824
200003 6.9721 890.2333 1.9801 128.5141 18.6225 3.3824
200004 6.9721 1885.7112 1.9509 128.5143 18.6226 3.3824
200005 6.9722 2019.7937 1.9305 128.5144 18.6226 3.3824
200006 6.9722 1436.9253 1.9398 128.5144 18.6226 3.3824
200007 6.9722 3219.3793 1.9180 128.5142 18.6226 3.3824
200008 6.9722 3453.6605 1.9274 128.5140 18.6225 3.3824
200009 6.9722 1744.3557 1.9254 128.5138 18.6225 3.3824
200010 6.9722 1043.9583 1.9036 128.5136 18.6225 3.3824
200011 6.9723 1408.1698 1.8684 128.5133 18.6224 3.3824
FT3_pmol.l
200000 5.6279
200001 5.6279
200002 5.6280
200003 5.6280
200004 5.6280
200005 5.6280
200006 5.6280
200007 5.6280
200008 5.6280
200009 5.6280
200010 5.6280
200011 5.6280
The code:
vars_to_use <- colnames(cbinded)
pmatrix <- scale(cbinded[, vars_to_use])
In the TT3_nmol.l column the code creates NaN values when scaled - and looking through str() and summary() I am unable to find any clues. This is very difficult to understand (for me at least)

Related

I have 2 graphs on R. They have different x axis, but similar trend profile. how do I overlay them on r?

I have 2 datasets (First and Second) shown below on their respective raw datasets.
They have different x-axis, but similar trend profile.
How do I align and overlay them to occur on a single plot on R using ggplot2?
My codes for their plots on R are:
For First:
First <- ggplot(data = First,
aes(x, y)) +
geom_line(pch = 1)
For Second:
Second <- ggplot(data = Second,
aes(x, y)) +
geom_line(pch = 1)
Raw dataset for First:
x y
129.46 532.87
129.44 533.97
129.43 534.48
129.42 524.14
129.40 525.10
129.39 517.73
129.37 517.06
129.36 517.98
129.35 511.68
129.33 506.21
129.32 503.39
129.31 492.87
129.29 484.60
129.28 481.26
129.26 473.19
129.25 469.08
129.24 464.39
129.22 456.28
129.21 452.46
129.19 447.01
129.18 439.83
129.17 434.11
129.15 426.85
129.14 421.21
129.12 414.52
129.11 409.71
129.10 404.59
129.08 399.91
129.07 393.89
129.05 388.65
129.04 383.33
129.03 379.13
129.01 375.56
129.00 370.54
128.98 366.30
128.97 362.54
128.96 356.00
128.94 351.95
128.93 347.81
128.91 343.64
128.90 339.57
128.89 335.33
128.87 331.19
128.86 328.30
128.84 325.86
128.83 323.46
128.82 321.77
128.80 319.47
128.79 316.96
128.77 314.35
128.76 311.30
128.75 308.95
128.73 307.41
128.72 304.59
128.70 302.33
128.69 299.55
128.68 297.95
128.66 296.19
128.65 294.39
128.63 292.42
128.62 289.79
128.61 287.52
128.59 285.54
128.58 283.74
128.57 281.68
128.55 279.89
128.54 278.65
128.52 277.48
128.51 275.45
128.50 273.93
128.48 272.46
128.47 271.14
128.45 269.65
128.44 267.75
128.43 266.05
128.41 264.15
128.40 262.82
128.38 261.77
128.37 261.36
128.36 260.28
128.34 259.67
128.33 258.81
128.31 258.05
128.30 258.05
128.29 257.27
128.27 256.64
128.26 256.02
128.24 254.40
128.23 253.57
128.22 252.97
128.20 252.69
128.19 252.08
128.17 251.61
128.16 250.88
128.15 250.67
128.13 250.52
128.12 249.97
128.10 249.84
128.09 248.82
128.08 249.06
128.06 248.00
128.05 247.06
128.03 246.84
128.02 247.20
128.01 248.07
127.99 247.46
127.98 246.58
127.96 246.86
127.95 247.03
127.94 246.67
127.92 247.20
127.91 247.80
127.90 247.61
127.88 247.87
127.87 247.77
127.85 247.42
127.84 248.48
127.83 248.90
127.81 249.92
127.80 251.29
127.78 252.16
127.77 253.10
127.76 254.39
127.74 255.47
127.73 256.43
127.71 257.68
127.70 258.32
127.69 259.63
127.67 261.89
127.66 263.23
127.64 265.47
127.63 267.10
127.62 269.05
127.60 271.09
127.59 272.48
127.57 274.91
127.56 276.54
127.55 278.50
127.53 279.27
127.52 280.13
127.50 280.96
127.49 281.58
127.48 281.73
127.46 282.27
127.45 282.77
127.43 282.81
127.42 282.59
127.41 282.14
127.39 281.05
127.38 280.53
127.36 279.07
127.35 277.24
127.34 276.30
127.32 274.52
127.31 272.61
127.29 271.43
127.28 270.06
127.27 268.06
127.25 267.17
127.24 265.80
127.23 264.93
127.21 264.38
127.20 263.39
127.18 263.05
127.17 262.48
127.16 261.55
127.14 261.36
127.13 260.32
127.11 259.54
127.10 260.12
127.09 260.55
127.07 260.92
127.06 261.55
127.04 262.40
127.03 262.71
127.02 263.56
127.00 264.18
126.99 264.76
126.97 264.76
126.96 264.48
126.95 265.54
126.93 267.23
126.92 268.28
126.90 269.27
126.89 270.39
126.88 271.40
126.86 272.81
126.85 273.91
126.83 275.63
126.82 277.38
126.81 277.79
126.79 279.41
126.78 279.75
126.76 280.53
126.75 282.72
126.74 284.13
126.72 286.31
126.71 288.78
126.69 290.37
126.68 292.47
126.67 294.45
126.65 296.41
126.64 299.01
126.62 300.27
126.61 300.60
126.60 302.39
126.58 304.41
126.57 306.27
126.56 309.08
126.54 311.47
126.53 314.92
126.51 317.62
126.50 320.79
126.49 324.88
126.47 327.88
126.46 331.98
126.44 334.43
126.43 336.38
126.42 339.31
126.40 342.30
126.39 345.26
126.37 349.00
126.36 353.23
126.35 355.80
126.33 359.43
126.32 362.46
126.30 365.44
126.29 368.90
126.28 371.33
126.26 373.43
126.25 375.84
126.23 376.66
126.22 377.24
126.21 378.86
126.19 380.56
126.18 382.81
126.16 384.93
126.15 386.63
126.14 389.33
126.12 392.04
126.11 393.12
126.09 395.23
126.08 397.14
126.07 397.97
126.05 398.70
126.04 400.18
126.02 402.96
126.01 406.16
126.00 410.46
125.98 414.02
125.97 419.10
125.95 423.51
125.94 429.04
125.93 433.63
125.91 439.10
125.90 445.74
125.88 448.74
125.87 454.18
125.86 458.68
125.84 464.89
125.83 471.47
125.82 479.85
125.80 487.35
125.79 495.42
125.77 505.03
125.76 514.95
125.75 525.05
125.73 536.33
125.72 545.53
125.70 555.22
125.69 566.94
125.68 578.38
125.66 592.60
125.65 610.46
125.63 627.96
125.62 644.92
125.61 667.07
125.59 690.26
125.58 716.45
125.56 743.96
125.55 772.56
125.54 802.98
125.52 834.70
125.51 861.03
125.49 893.29
125.48 928.74
125.47 959.44
125.45 986.00
125.44 1007.16
125.42 1025.04
125.41 1037.34
125.40 1045.97
125.38 1047.54
125.37 1046.52
125.35 1040.06
125.34 1033.93
125.33 1028.62
125.31 1019.46
125.30 1009.75
125.28 998.56
125.27 985.23
125.26 969.51
125.24 954.00
125.23 937.87
125.21 921.84
125.20 904.31
125.19 886.50
125.17 869.52
125.16 855.01
125.15 841.79
125.13 826.35
125.12 812.49
125.10 798.08
125.09 783.09
125.08 768.02
125.06 751.49
125.05 735.61
125.03 720.00
125.02 705.38
125.01 690.72
124.99 676.87
124.98 663.52
124.96 652.62
124.95 642.21
124.94 631.57
124.92 620.73
124.91 609.34
124.89 599.22
124.88 589.48
124.87 578.93
124.85 569.27
124.84 557.89
124.82 548.03
124.81 539.04
124.80 529.46
124.78 520.41
124.77 512.79
124.75 504.41
124.74 494.50
124.73 484.16
124.71 474.33
124.70 463.87
124.68 453.91
124.67 442.96
124.66 432.59
124.64 421.67
124.63 412.34
124.61 402.25
124.60 391.99
124.59 384.48
124.57 375.79
124.56 366.30
124.54 357.78
124.53 349.52
124.52 340.83
124.50 333.56
124.49 324.78
124.48 316.03
124.46 308.79
124.45 301.12
124.43 294.10
124.42 287.40
124.41 280.85
124.39 275.99
124.38 269.42
124.36 264.00
124.35 258.31
124.34 252.82
124.32 248.27
124.31 243.83
124.29 239.23
124.28 234.31
124.27 230.57
124.25 226.70
124.24 222.75
124.22 219.43
124.21 215.93
124.20 212.76
124.18 209.68
124.17 206.41
124.15 203.55
124.14 200.64
124.13 198.50
124.11 196.15
124.10 193.52
124.08 191.50
124.07 189.29
124.06 187.49
124.04 185.83
124.03 184.40
124.01 182.50
124.00 181.13
123.99 179.58
123.97 178.32
123.96 177.52
123.94 176.60
123.93 175.97
123.92 175.14
123.90 174.42
123.89 173.82
123.87 173.33
123.86 172.90
123.85 172.59
123.83 172.14
123.82 171.81
123.80 171.40
123.79 171.32
123.78 171.27
123.76 171.26
123.75 171.29
123.74 171.30
123.72 171.15
123.71 171.20
123.69 171.05
123.68 170.71
123.67 170.44
123.65 170.09
123.64 169.57
123.62 168.99
123.61 168.32
123.60 167.77
123.58 167.32
123.57 166.69
123.55 166.03
123.54 165.45
123.53 164.87
123.51 164.10
123.50 163.33
123.48 162.63
123.47 162.00
123.46 161.37
123.44 160.56
123.43 159.85
123.41 159.23
123.40 158.66
123.39 158.23
123.37 157.77
123.36 157.43
123.34 157.03
123.33 156.67
123.32 156.09
123.30 155.41
123.29 155.02
123.27 154.63
123.26 154.00
123.25 153.36
123.23 152.90
123.22 152.52
123.20 152.22
123.19 151.95
123.18 151.78
123.16 151.64
123.15 151.54
123.13 151.23
123.12 150.99
123.11 150.81
123.09 150.59
123.08 150.38
123.07 150.11
123.05 149.89
123.04 149.75
123.02 149.66
123.01 149.63
123.00 149.83
122.98 150.07
122.97 150.18
122.95 150.38
122.94 150.48
122.93 150.76
122.91 151.21
122.90 151.06
122.88 151.18
122.87 151.47
122.86 151.93
122.84 152.12
122.83 152.41
122.81 152.93
122.80 153.56
122.79 154.44
122.77 155.16
122.76 155.76
122.74 156.56
122.73 157.35
122.72 158.24
122.70 159.00
122.69 159.72
122.67 160.70
122.66 161.41
122.65 162.03
122.63 162.70
122.62 163.31
122.60 163.98
122.59 164.61
122.58 165.13
122.56 165.54
122.55 165.72
122.53 165.78
122.52 165.61
122.51 165.27
122.49 164.97
122.48 164.62
122.46 164.08
122.45 163.49
122.44 162.59
122.42 161.87
122.41 161.26
122.40 160.59
122.38 160.01
122.37 159.52
122.35 158.90
122.34 158.05
122.33 157.02
122.31 156.18
122.30 155.43
122.28 154.64
122.27 153.81
122.26 153.00
122.24 152.30
122.23 151.48
122.21 150.83
122.20 150.15
122.19 149.72
122.17 149.32
122.16 148.91
122.14 148.41
122.13 148.05
122.12 147.78
122.10 147.31
122.09 146.96
122.07 146.90
122.06 146.74
122.05 146.55
122.03 146.53
122.02 147.33
122.00 146.93
121.99 146.75
121.98 146.76
121.96 146.89
121.95 147.08
121.93 147.47
121.92 147.95
121.91 148.47
121.89 148.91
121.88 149.44
121.86 150.03
121.85 150.46
121.84 150.94
121.82 151.46
121.81 152.04
121.79 152.43
121.78 152.67
121.77 152.92
121.75 153.19
121.74 153.50
121.72 153.58
121.71 153.69
121.70 153.81
121.68 153.71
121.67 153.58
121.66 153.20
121.64 152.85
121.63 152.70
121.61 152.24
121.60 151.67
121.59 150.90
121.57 150.41
121.56 149.84
121.54 149.28
121.53 148.58
121.52 148.05
121.50 147.70
121.49 147.15
121.47 146.79
121.46 146.48
121.45 146.24
121.43 145.94
121.42 145.52
121.40 145.30
121.39 145.38
121.38 145.36
121.36 145.28
121.35 145.65
121.33 145.55
121.32 145.75
121.31 146.25
121.29 146.42
121.28 146.81
121.26 147.12
121.25 147.17
121.24 147.47
121.22 147.71
121.21 147.78
121.19 147.95
121.18 148.34
121.17 148.32
121.15 148.54
121.14 148.44
121.12 148.52
121.11 148.70
121.10 148.77
121.08 148.92
121.07 148.95
121.05 148.73
121.04 148.28
121.03 148.15
121.01 147.66
121.00 147.44
120.99 147.17
120.97 146.65
120.96 146.66
120.94 146.30
120.93 146.32
120.92 146.36
120.90 146.05
120.89 146.16
120.87 145.92
120.86 145.57
120.85 145.71
120.83 145.05
120.82 145.49
120.80 145.59
120.79 145.24
120.78 145.48
120.76 146.02
120.75 145.67
120.73 146.44
120.72 147.36
120.71 147.80
120.69 148.87
120.68 147.89
120.66 148.12
120.65 148.79
120.64 147.28
120.62 148.47
120.61 149.10
120.59 149.42
120.58 149.45
120.57 149.90
120.55 150.28
120.54 150.52
120.52 150.43
120.51 150.94
120.50 150.73
120.48 151.13
120.47 151.24
120.45 151.32
120.44 150.96
120.43 150.80
120.41 150.61
120.40 150.41
120.38 150.48
120.37 150.96
120.36 151.60
120.34 152.14
120.33 152.05
120.32 152.51
120.30 152.53
120.29 152.56
120.27 152.63
120.26 152.53
120.25 152.28
120.23 151.96
120.22 150.96
120.20 149.81
120.19 149.15
120.18 148.75
120.16 148.42
120.15 147.90
120.13 147.60
120.12 147.37
120.11 146.73
120.09 146.94
120.08 146.99
120.06 146.53
120.05 146.26
120.04 147.40
120.02 149.56
120.01 148.57
119.99 150.23
119.98 148.50
119.97 149.44
119.95 153.75
119.94 154.59
119.92 158.31
119.91 163.60
119.90 170.53
119.88 176.49
119.87 183.77
119.85 195.72
119.84 199.95
119.83 203.86
119.81 196.98
119.80 186.12
119.78 181.83
The second is:
x y
142.06 483.07
142.05 481.22
142.03 480.65
142.02 477.31
142.01 469.69
141.99 461.74
141.98 455.80
141.96 450.03
141.95 440.94
141.94 436.92
141.92 439.83
141.91 448.89
141.89 451.64
141.88 445.06
141.87 436.29
141.85 436.91
141.84 439.85
141.82 438.04
141.81 437.54
141.80 440.88
141.78 440.12
141.77 441.93
141.75 441.75
141.74 443.65
141.73 437.05
141.71 435.76
141.70 438.81
141.68 442.95
141.67 445.62
141.66 445.92
141.64 445.68
141.63 441.25
141.62 440.84
141.60 435.75
141.59 429.87
141.57 429.70
141.56 435.20
141.55 434.71
141.53 433.26
141.52 433.86
141.50 435.97
141.49 436.62
141.48 438.29
141.46 436.82
141.45 436.19
141.43 430.53
141.42 425.53
141.41 423.40
141.39 422.70
141.38 427.22
141.36 429.55
141.35 430.31
141.34 433.64
141.32 437.53
141.31 436.35
141.29 436.65
141.28 439.47
141.27 437.66
141.25 436.88
141.24 428.98
141.22 426.74
141.21 431.80
141.20 434.16
141.18 436.85
141.17 439.57
141.15 441.25
141.14 446.21
141.13 445.51
141.11 446.65
141.10 448.60
141.08 445.50
141.07 442.42
141.06 439.73
141.04 437.68
141.03 439.24
141.01 445.00
141.00 446.63
140.99 451.07
140.97 452.34
140.96 453.97
140.94 458.24
140.93 459.39
140.92 462.71
140.90 464.21
140.89 462.70
140.87 462.00
140.86 460.58
140.85 460.49
140.83 464.55
140.82 471.15
140.80 470.22
140.79 472.05
140.78 472.89
140.76 475.38
140.75 478.31
140.73 479.60
140.72 483.60
140.71 486.64
140.69 490.09
140.68 490.27
140.67 490.00
140.65 493.38
140.64 499.44
140.62 499.82
140.61 501.45
140.60 502.86
140.58 503.88
140.57 505.28
140.55 506.91
140.54 511.23
140.53 515.51
140.51 517.53
140.50 517.70
140.48 517.27
140.47 517.27
140.46 514.41
140.44 513.87
140.43 513.18
140.41 510.40
140.40 502.88
140.39 499.08
140.37 494.34
140.36 493.15
140.34 497.87
140.33 499.36
140.32 498.40
140.30 495.46
140.29 490.72
140.27 485.64
140.26 479.75
140.25 474.79
140.23 470.13
140.22 461.47
140.20 459.50
140.19 457.55
140.18 455.43
140.16 461.16
140.15 469.09
140.13 471.04
140.12 469.66
140.11 462.89
140.09 454.46
140.08 448.36
140.06 440.22
140.05 432.27
140.04 424.39
140.02 418.62
140.01 416.53
139.99 414.79
139.98 418.52
139.97 429.46
139.95 439.80
139.94 446.26
139.92 443.80
139.91 438.85
139.90 432.84
139.88 431.29
139.87 427.68
139.85 422.87
139.84 419.23
139.83 414.42
139.81 411.25
139.80 413.78
139.79 419.72
139.77 424.95
139.76 429.25
139.74 427.59
139.73 422.81
139.72 417.27
139.70 416.84
139.69 417.09
139.67 414.80
139.66 412.47
139.65 413.25
139.63 412.05
139.62 416.88
139.60 421.99
139.59 425.06
139.58 434.19
139.56 436.34
139.55 435.10
139.53 430.10
139.52 431.28
139.51 433.26
139.49 434.26
139.48 431.66
139.46 433.82
139.45 436.17
139.44 438.31
139.42 445.14
139.41 452.12
139.39 460.34
139.38 468.53
139.37 469.48
139.35 467.94
139.34 471.17
139.32 475.65
139.31 478.09
139.30 477.27
139.28 478.26
139.27 477.40
139.25 480.09
139.24 485.09
139.23 491.05
139.21 496.55
139.20 500.31
139.18 502.52
139.17 498.99
139.16 497.95
139.14 498.37
139.13 500.68
139.11 503.28
139.10 505.85
139.09 506.35
139.07 507.11
139.06 513.07
139.04 520.05
139.03 527.38
139.02 532.70
139.00 536.39
138.99 541.80
138.97 544.73
138.96 547.06
138.95 551.20
138.93 554.44
138.92 558.82
138.90 564.68
138.89 569.71
138.88 580.95
138.86 593.55
138.85 606.50
138.84 621.86
138.82 632.23
138.81 639.43
138.79 649.10
138.78 661.02
138.77 672.71
138.75 683.65
138.74 697.95
138.72 711.85
138.71 721.70
138.70 742.52
138.68 764.57
138.67 786.43
138.65 812.39
138.64 838.32
138.63 862.37
138.61 882.57
138.60 908.42
138.58 937.86
138.57 962.48
138.56 986.73
138.54 1015.64
138.53 1040.43
138.51 1068.36
138.50 1104.88
138.49 1143.82
138.47 1190.99
138.46 1232.34
138.44 1273.42
138.43 1296.43
138.42 1323.50
138.40 1347.81
138.39 1363.65
138.37 1369.67
138.36 1382.39
138.35 1388.82
138.33 1389.04
138.32 1391.43
138.30 1393.68
138.29 1398.80
138.28 1394.21
138.26 1384.65
138.25 1364.55
138.23 1337.52
138.22 1326.20
138.21 1306.90
138.19 1283.38
138.18 1270.16
138.16 1249.03
138.15 1230.29
138.14 1223.17
138.12 1213.08
138.11 1211.40
138.09 1212.51
138.08 1200.52
138.07 1185.42
138.05 1161.96
138.04 1143.77
138.02 1123.02
138.01 1093.99
138.00 1077.22
137.98 1059.70
137.97 1035.84
137.96 1027.20
137.94 1025.29
137.93 1015.19
137.91 1012.58
137.90 1006.32
137.89 984.20
137.87 964.25
137.86 941.66
137.84 922.75
137.83 906.69
137.82 882.85
137.80 871.76
137.79 857.74
137.77 848.72
137.76 846.38
137.75 839.06
137.73 833.21
137.72 822.04
137.70 804.83
137.69 783.16
137.68 774.40
137.66 758.48
137.65 744.32
137.63 732.52
137.62 722.43
137.61 712.14
137.59 704.13
137.58 699.86
137.56 697.26
137.55 692.86
137.54 684.29
137.52 669.33
137.51 650.79
137.49 639.53
137.48 630.92
137.47 619.08
137.45 607.80
137.44 599.49
137.42 587.80
137.41 579.81
137.40 571.73
137.38 564.87
137.37 559.58
137.35 549.88
137.34 538.16
137.33 525.07
137.31 514.06
137.30 505.49
137.28 497.80
137.27 487.99
137.26 479.18
137.24 470.91
137.23 460.88
137.21 455.19
137.20 448.80
137.19 440.92
137.17 434.03
137.16 424.79
137.14 416.53
137.13 408.00
137.12 401.20
137.10 394.36
137.09 387.62
137.07 380.90
137.06 374.20
137.05 367.24
137.03 360.99
137.02 354.70
137.01 348.64
136.99 342.50
136.98 335.56
136.96 329.23
136.95 322.95
136.94 317.64
136.92 312.24
136.91 308.07
136.89 303.21
136.88 298.65
136.87 293.95
136.85 288.35
136.84 283.98
136.82 280.04
136.81 275.83
136.80 272.23
136.78 268.40
136.77 264.82
136.75 262.04
136.74 259.04
136.73 256.31
136.71 253.72
136.70 250.91
136.68 248.53
136.67 246.17
136.66 243.85
136.64 241.94
136.63 239.81
136.61 238.02
136.60 235.93
136.59 233.98
136.57 232.39
136.56 230.67
136.54 229.24
136.53 227.66
136.52 226.07
136.50 224.55
136.49 222.98
136.47 221.41
136.46 219.70
136.45 218.23
136.43 216.48
136.42 214.75
136.40 213.16
136.39 211.33
136.38 209.93
136.36 208.55
136.35 206.95
136.33 205.56
136.32 204.10
136.31 202.87
136.29 201.66
136.28 200.54
136.26 199.10
136.25 197.71
136.24 196.47
136.22 195.42
136.21 194.51
136.19 193.55
136.18 192.66
136.17 191.81
136.15 191.09
136.14 190.37
136.13 189.78
136.11 189.06
136.10 188.53
136.08 187.81
136.07 187.02
136.06 186.32
136.04 185.86
136.03 185.72
136.01 185.46
136.00 185.06
135.99 184.91
135.97 184.74
135.96 184.66
135.94 184.70
135.93 184.75
135.92 184.67
135.90 184.74
135.89 185.58
135.87 184.94
135.86 184.83
135.85 185.37
135.83 185.96
135.82 186.52
135.80 187.16
135.79 187.97
135.78 188.76
135.76 189.75
135.75 190.56
135.73 191.43
135.72 192.48
135.71 193.43
135.69 194.49
135.68 195.61
135.66 196.96
135.65 198.34
135.64 199.56
135.62 200.90
135.61 202.40
135.59 203.76
135.58 205.23
135.57 206.56
135.55 207.97
135.54 209.31
135.52 210.44
135.51 211.36
135.50 212.20
135.48 212.95
135.47 213.47
135.45 213.92
135.44 214.11
135.43 214.10
135.41 213.94
135.40 213.64
135.38 213.19
135.37 212.59
135.36 211.82
135.34 210.75
135.33 209.66
135.31 208.46
135.30 207.14
135.29 205.82
135.27 204.44
135.26 203.15
135.24 201.80
135.23 200.48
135.22 199.35
135.20 198.28
135.19 197.23
135.18 196.15
135.16 195.07
135.15 194.03
135.13 192.96
135.12 192.21
135.11 191.53
135.09 190.87
135.08 190.32
135.06 190.02
135.05 189.82
135.04 189.84
135.02 189.89
135.01 189.82
134.99 190.02
134.98 189.88
134.97 190.09
134.95 190.45
134.94 190.82
134.92 191.60
134.91 192.45
134.90 193.26
134.88 194.27
134.87 195.37
134.85 196.61
134.84 197.86
134.83 199.11
134.81 200.35
134.80 201.58
134.78 202.68
134.77 203.60
134.76 204.22
134.74 205.07
134.73 206.51
134.71 209.37
134.70 206.97
134.69 207.18
134.67 207.52
134.66 207.90
134.64 208.21
134.63 208.21
134.62 208.27
134.60 207.19
134.59 206.58
134.57 205.72
134.56 204.81
134.55 204.11
134.53 203.64
134.52 202.92
134.50 202.02
134.49 201.22
134.48 200.36
134.46 199.68
134.45 198.92
134.43 198.29
134.42 197.56
134.41 196.73
134.39 196.08
134.38 195.75
134.36 195.52
134.35 195.63
134.34 195.81
134.32 196.02
134.31 196.20
134.30 196.80
134.28 196.90
134.27 197.19
134.25 197.74
134.24 198.08
134.23 198.31
134.21 198.68
134.20 199.22
134.18 199.70
134.17 200.18
134.16 200.93
134.14 201.64
134.13 202.24
134.11 202.68
134.10 203.27
134.09 203.68
134.07 204.09
134.06 204.19
134.04 204.23
134.03 204.12
134.02 204.37
134.00 203.50
133.99 202.88
133.97 202.47
133.96 202.08
133.95 201.85
133.93 201.56
133.92 201.16
133.90 201.05
133.89 200.73
133.88 200.97
133.86 202.35
133.85 201.84
133.83 198.75
133.82 197.11
133.81 196.25
133.79 195.58
133.78 195.22
133.76 195.54
133.75 195.44
133.74 195.13
133.72 195.43
133.71 195.90
133.69 196.28
133.68 196.45
133.67 197.47
133.65 197.88
133.64 199.96
133.62 205.28
133.61 198.80
133.60 196.61
133.58 194.43
133.57 193.35
133.55 191.96
133.54 190.94
133.53 189.94
133.51 188.91
133.50 187.44
133.48 187.05
133.47 200.13
133.46 194.78
133.44 183.44
133.43 183.11
133.41 182.48
133.40 181.97
133.39 184.17
133.37 181.21
133.36 184.86
133.35 183.46
133.33 181.41
133.32 181.87
133.30 182.53
133.29 182.31
133.28 181.29
133.26 181.50
133.25 181.17
133.23 184.41
133.22 183.61
133.21 186.67
133.19 182.59
133.18 181.21
133.16 180.85
133.15 184.65
133.14 184.11
133.12 182.34
133.11 189.83
133.09 190.95
133.08 199.73
133.07 214.60
133.05 223.41
133.04 220.76
133.02 248.98
133.01 296.96
133.00 308.09
132.98 263.16
enter code here
These data look like some kind of spectra, so I understand the desire to plot them on top of each other to compare shape. The following code aligns the peaks on each set, but you will have an arbitrary x-axis (so I removed the labels).
first$match <- first$x
second$match <- second$x - second$x[second$y == max(second$y)] + first$x[first$y == max(first$y)]
first$series = "first"
second$series = "second"
all_data = rbind(first, second)
ggplot(all_data) + geom_line(aes(x = match, y, color = series) +
scale_x_continuous(name = "X, arbitrary units") +
theme(axis.text.x = element_blank())
par(mfrow=c(1,2))
First
Second
should plot the two next to each other but not on top of each other.
Depending on how you want to visualize this you should combine the dataframes into a single dataframe with the source as a column. Then either have each on the same plot with a different colour etc., or use facet_wrap. Example:
library(tidyverse)
first <- tibble(x = 1:1000, y = x + runif(1000))
second <- tibble(x = 1001:2000, y = x + runif(1000))
combo <- first %>%
mutate(source = "first") %>%
bind_rows(
second %>%
mutate(source = "second")
)
combo %>%
ggplot(aes(x,y, colour = source))+
geom_line()
#or
combo %>%
ggplot(aes(x,y))+
geom_line()+
facet_wrap(~source)

R: Using read.table to import a column with a different delimiter than other columns?

I have a txt file of chess games from http://chess-research-project.readthedocs.io/en/latest/. The first 8 lines of the file are as follows:
# #
# datetime 2013-08-10 22:32:16.640552
# program programs/formats/pgn_to_filtered_very_basic_format_plus_info_filtering_info.py
# filein original_data/scidbase/all.pgn
# 1.t 2.date 3.result 4.welo 5.belo 6.len 7.date_c 8.resu_c 9.welo_c 10.belo_c 11.edate_c 12.setup 13.fen 14.resu2_c 15.oyrange 16.bad_len 17.game...
1 2000.03.14 1-0 2851 None 67 date_false result_false welo_false belo_true edate_true setup_false fen_false result2_false oyrange_false blen_false ### W1.d4 B1.d5 W2.c4 B2.e6 W3.Nc3 B3.Nf6 W4.cxd5 B4.exd5 W5.Bg5 B5.Be7 W6.e3 B6.Ne4 W7.Bxe7 B7.Nxc3 W8.Bxd8 B8.Nxd1 W9.Bxc7 B9.Nxb2 W10.Rb1 B10.Nc4 W11.Bxc4 B11.dxc4 W12.Ne2 B12.O-O W13.Nc3 B13.b6 W14.d5 B14.Na6 W15.Bd6 B15.Rd8 W16.Ba3 B16.Bb7 W17.e4 B17.f6 W18.Ke2 B18.Nc7 W19.Rhd1 B19.Ba6 W20.Ke3 B20.Kf7 W21.g4 B21.g5 W22.h4 B22.h6 W23.Rh1 B23.Re8 W24.f3 B24.Bb7 W25.hxg5 B25.fxg5 W26.d6 B26.Nd5+ W27.Nxd5 B27.Bxd5 W28.Rxh6 B28.c3 W29.d7 B29.Re6 W30.Rh7+ B30.Kg8 W31.Rbh1 B31.Bc6 W32.Rh8+ B32.Kf7 W33.Rxa8 B33.Bxd7 W34.Rh7+
2 2000.03.14 1-0 2851 None 53 date_false result_false welo_false belo_true edate_true setup_false fen_false result2_false oyrange_false blen_false ### W1.e4 B1.d5 W2.exd5 B2.Qxd5 W3.Nc3 B3.Qa5 W4.d4 B4.Nf6 W5.Nf3 B5.c6 W6.Ne5 B6.Bf5 W7.g4 B7.Be4 W8.f3 B8.Bd5 W9.a3 B9.Nbd7 W10.Be3 B10.Nxe5 W11.dxe5 B11.Nxg4 W12.Bd4 B12.e6 W13.b4 B13.Qd8 W14.Nxd5 B14.Qxd5 W15.c4 B15.Ne3 W16.cxd5 B16.Nxd1 W17.dxc6 B17.bxc6 W18.Rxd1 B18.Be7 W19.Ba6 B19.O-O W20.Ke2 B20.Rab8 W21.Rc1 B21.Rfd8 W22.Rhd1 B22.c5 W23.Bxc5 B23.Rxd1 W24.Rxd1 B24.Bxc5 W25.bxc5 B25.g6 W26.c6 B26.Rb2+ W27.Rd2
3 1999.11.20 1-0 2851 None 57 date_false result_false welo_false belo_true edate_false setup_false fen_false result2_false oyrange_false blen_false ### W1.e4 B1.e5 W2.Nf3 B2.Nc6 W3.Bc4 B3.Bc5 W4.c3 B4.Nf6 W5.d3 B5.d6 W6.Bb3 B6.O-O W7.Nbd2 B7.Be6 W8.O-O B8.Qd7 W9.Re1 B9.Rfe8 W10.Nf1 B10.Ne7 W11.Ng3 B11.Bg4 W12.h3 B12.Be6 W13.Bg5 B13.Kh8 W14.Bxf6 B14.gxf6 W15.d4 B15.exd4 W16.cxd4 B16.Bb4 W17.Re3 B17.Rg8 W18.d5 B18.Bxh3 W19.Qd4 B19.Rg6 W20.Qxb4 B20.c5 W21.Qc3 B21.Bg4 W22.Bc2 B22.Rh6 W23.Nh2 B23.b5 W24.b4 B24.Rc8 W25.Bd3 B25.c4 W26.Bc2 B26.Bh5 W27.Nxh5 B27.Rxh5 W28.Qxf6+ B28.Kg8 W29.Bd1
There are 17 columns, the first 16 showing some information about each game, and the 17th being the game moves. This 17th column is different to the others as it starts after ###, and also has a space after each move. How should read.table() (or a similar function) by used so that the game moves are properly imported into their own column?
Extracting column (1 to 16) and (17) separately:
If reading from file, text_file.txt:
# extracting columns 1 to 16 and empty column for 17
df <- read.table(file = 'text_file.txt', sep = " ")
n <- nrow(df)
# split string on both " ### " and "\n"
line = readLines('text_file.txt')
str = grep(line, value=TRUE, pattern = "###")
chr_vec <- unlist(strsplit(x = str, split = " ### |\n"))
# indices for column 17 elements in chr_vec
idx_17 <- 2*(1:n)
df['V17'] <- chr_vec[idx_17]
If reading from string str:
# extracting columns 1 to 16 and empty column for 17
df <- read.table(text = str, sep = " ", header = TRUE)
n <- nrow(df)
# split string on both " ### " and "\n"
chr_vec <- unlist(strsplit(x = str, split = " ### |\n"))
# indices for column 17 elements in chr_vec
idx_17 <- 2*(1:n) + 1
df['X17.game...'] <- chr_vec[idx_17]
Data:
str <- "1.t 2.date 3.result 4.welo 5.belo 6.len 7.date_c 8.resu_c 9.welo_c 10.belo_c 11.edate_c 12.setup 13.fen 14.resu2_c 15.oyrange 16.bad_len 17.game...
1 2000.03.14 1-0 2851 None 67 date_false result_false welo_false belo_true edate_true setup_false fen_false result2_false oyrange_false blen_false ### W1.d4 B1.d5 W2.c4 B2.e6 W3.Nc3 B3.Nf6 W4.cxd5 B4.exd5 W5.Bg5 B5.Be7 W6.e3 B6.Ne4 W7.Bxe7 B7.Nxc3 W8.Bxd8 B8.Nxd1 W9.Bxc7 B9.Nxb2 W10.Rb1 B10.Nc4 W11.Bxc4 B11.dxc4 W12.Ne2 B12.O-O W13.Nc3 B13.b6 W14.d5 B14.Na6 W15.Bd6 B15.Rd8 W16.Ba3 B16.Bb7 W17.e4 B17.f6 W18.Ke2 B18.Nc7 W19.Rhd1 B19.Ba6 W20.Ke3 B20.Kf7 W21.g4 B21.g5 W22.h4 B22.h6 W23.Rh1 B23.Re8 W24.f3 B24.Bb7 W25.hxg5 B25.fxg5 W26.d6 B26.Nd5+ W27.Nxd5 B27.Bxd5 W28.Rxh6 B28.c3 W29.d7 B29.Re6 W30.Rh7+ B30.Kg8 W31.Rbh1 B31.Bc6 W32.Rh8+ B32.Kf7 W33.Rxa8 B33.Bxd7 W34.Rh7+
2 2000.03.14 1-0 2851 None 53 date_false result_false welo_false belo_true edate_true setup_false fen_false result2_false oyrange_false blen_false ### W1.e4 B1.d5 W2.exd5 B2.Qxd5 W3.Nc3 B3.Qa5 W4.d4 B4.Nf6 W5.Nf3 B5.c6 W6.Ne5 B6.Bf5 W7.g4 B7.Be4 W8.f3 B8.Bd5 W9.a3 B9.Nbd7 W10.Be3 B10.Nxe5 W11.dxe5 B11.Nxg4 W12.Bd4 B12.e6 W13.b4 B13.Qd8 W14.Nxd5 B14.Qxd5 W15.c4 B15.Ne3 W16.cxd5 B16.Nxd1 W17.dxc6 B17.bxc6 W18.Rxd1 B18.Be7 W19.Ba6 B19.O-O W20.Ke2 B20.Rab8 W21.Rc1 B21.Rfd8 W22.Rhd1 B22.c5 W23.Bxc5 B23.Rxd1 W24.Rxd1 B24.Bxc5 W25.bxc5 B25.g6 W26.c6 B26.Rb2+ W27.Rd2
3 1999.11.20 1-0 2851 None 57 date_false result_false welo_false belo_true edate_false setup_false fen_false result2_false oyrange_false blen_false ### W1.e4 B1.e5 W2.Nf3 B2.Nc6 W3.Bc4 B3.Bc5 W4.c3 B4.Nf6 W5.d3 B5.d6 W6.Bb3 B6.O-O W7.Nbd2 B7.Be6 W8.O-O B8.Qd7 W9.Re1 B9.Rfe8 W10.Nf1 B10.Ne7 W11.Ng3 B11.Bg4 W12.h3 B12.Be6 W13.Bg5 B13.Kh8 W14.Bxf6 B14.gxf6 W15.d4 B15.exd4 W16.cxd4 B16.Bb4 W17.Re3 B17.Rg8 W18.d5 B18.Bxh3 W19.Qd4 B19.Rg6 W20.Qxb4 B20.c5 W21.Qc3 B21.Bg4 W22.Bc2 B22.Rh6 W23.Nh2 B23.b5 W24.b4 B24.Rc8 W25.Bd3 B25.c4 W26.Bc2 B26.Bh5 W27.Nxh5 B27.Rxh5 W28.Qxf6+ B28.Kg8 W29.Bd1"

What is the format of "{123, affdsf, 223, 22, dgbwa, 33333}"?

I have the following format, please advise how to convert it to a list in R?
"{1948, 2507, 2510, 7030, 7110, 9009, 00027, 00206, 00399, 00717, 00814, 00828, 00848, 00917, 01050, 01105, 01144, 02130, 02768, 03037, 03752, 03754, 04070, 04110, 05050, 05255, 05289, 05564, 05595, 06100, 06330, 06671, 07041, 07119, 07137, 07273, 07313, 07454, 07871, 08104, 08714, 08726, 08995, 09059, 09073, 09525, 09949, 09981, 10092, 10439, 10782, 11185, 11507, 11712, 11806, 11858, 11980, 12067, 12113, 12139, 12643, 13820, 14534, 15007, 15014, 15549, 15953, 16151, 16174, 16634, 16733, 16888, 17111, 17207, 17377, 17721, 17900, 18118, 18400, 18686, 18880, 19080, 19342, 19444, 19772, 19790, 19891, 20091, 20245, 20402, 20811, 21114, 21345, 21811, 21881, 22222, 22311, 22320, 22831, 22969, 23251, 23572, 23734, 23862, 23889, 24034, 24463, 25172, 25688, 26143, 26221, 26803, 26850, 26898, 27497, 28291, 28343, 29411, 29419, 30024, 30561, 30923, 31345, 31351, 31555, 31927, 32198, 32861, 33020, 33040, 33095, 33188, 33311, 33368, 33377, 33475, 33519, 33574, 33592, 34207, 34235, 34272, 34484, 34854, 34872, 34875, 34876, 34880, 35222, 35292, 35344, 36177, 36266, 37038, 37060, 37548, 37686, 37700, 38139, 39368, 39369, 39633, 40132, 40698, 40704, 40744, 40819, 41311, 41971, 42102, 42616, 43055, 43211, 43234, 43428, 43494, 43934, 44117, 44252, 44272, 44301, 44336, 44619, 44866, 44888, 45049, 45197, 45412, 45718, 46694, 46736, 47000, 48046, 48540, 49078, 49109, 49216, 49388, 49464, 50056, 50155, 50217, 50477, 50692, 51122, 51445, 51946, 52475, 52537, 52982, 54011, 54031, 54160, 54963, 55000, 55537, 56080, 56163, 56282, 56760, 56787, 57102, 57727, 57871, 58101, 58558, 58882, 59902, 60225, 60397, 60501, 60619, 60703, 60890, 61075, 61894, 61944, 62322, 62337, 62380, 62413, 62729, 62766, 62923, 63010, 63234, 63977, 64127, 65359, 65428, 65542, 65750, 65863, 66184, 66636, 66712, 67201, 67439, 67953, 68133, 68854, 69251, 69959, 70107, 70725, 70768, 71081, 71099, 71948, 72013, 72377, 72400, 72420, 72735, 73000, 73015, 73142, 73223, 73455, 73717, 74049, 74492, 74854, 74941, 75142, 75399, 75464, 75587, 75618, 75642, 75887, 76357, 76651, 77199, 77302, 77456, 77579, 77601, 77649, 77668, 77694, 77745, 78006, 78010, 78178, 78335, 78656, 78729, 78808, 78824, 78844, 78945, 79416, 79471, 79915, 80077, 80111, 80189, 80262, 80409, 80470, 80529, 80539, 80838, 81272, 81513, 81658, 81740, 81743, 81762, 81843, 82001, 82070, 82106, 82342, 82472, 82719, 83670, 84009, 84151, 84299, 84430, 84450, 84460, 84945, 86411, 86443, 86446, 86668, 86942, 87286, 87317, 87624, 87785, 88023, 88517, 88696, 88787, 88868, 88977, 89206, 90108, 90440, 90734, 90802, 90849, 90920, 90931, 91011, 91031, 91133, 91777, 91949, 92162, 92494, 93012, 93172, 94300, 94517, 95142, 95410, 95559, 95859, 96112, 97255, 97787, 97986, 98240, 98817, 99050, 99198, 99222, 99241, 99295, 99326, 99335, 99503, 99603, 99643, 99803, 99968}"
THIS IS NOT A DUPLICATE OF convert json to list in a vectorized way in R
IT'S COMPLETELY DIFFERENT BECAUSE THE FORMAT IS ABSOLUTELY DIFFERENT.
Try this one line code:
as.numeric(sapply(strsplit(substr(j,2,nchar(j)-1),split = ","),trimws))
[1] 1948 2507 2510 7030 7110 9009 27 206 399 717 814 828 848 917 1050 1105 1144
[18] 2130 2768 3037 3752 3754 4070 4110 5050 5255 5289 5564 5595 6100 6330 6671 7041 7119
[35] 7137 7273 7313 7454 7871 8104 8714 8726 8995 9059 9073 9525 9949 9981 10092 10439 10782
[52] 11185 11507 11712 11806 11858 11980 12067 12113 1213 ..
Your input:
j<-"{1948, 2507, 2510, 7030, 7110, 9009, 00027, 00206, 00399, 00717, 00814, 00828, 00848, 00917, 01050, 01105, 01144, 02130, 02768, 03037, 03752, 03754, 04070, 04110, 05050, 05255, 05289, 05564, 05595, 06100, 06330, 06671, 07041, 07119, 07137, 07273, 07313, 07454, 07871, 08104, 08714, 08726, 08995, 09059, 09073, 09525, 09949, 09981, 10092, 10439, 10782, 11185, 11507, 11712, 11806, 11858, 11980, 12067, 12113, 12139, 12643, 13820, 14534, 15007, 15014, 15549, 15953, 16151, 16174, 16634, 16733, 16888, 17111, 17207, 17377, 17721, 17900, 18118, 18400, 18686, 18880, 19080, 19342, 19444, 19772, 19790, 19891, 20091, 20245, 20402, 20811, 21114, 21345, 21811, 21881, 22222, 22311, 22320, 22831, 22969, 23251, 23572, 23734, 23862, 23889, 24034, 24463, 25172, 25688, 26143, 26221, 26803, 26850, 26898, 27497, 28291, 28343, 29411, 29419, 30024, 30561, 30923, 31345, 31351, 31555, 31927, 32198, 32861, 33020, 33040, 33095, 33188, 33311, 33368, 33377, 33475, 33519, 33574, 33592, 34207, 34235, 34272, 34484, 34854, 34872, 34875, 34876, 34880, 35222, 35292, 35344, 36177, 36266, 37038, 37060, 37548, 37686, 37700, 38139, 39368, 39369, 39633, 40132, 40698, 40704, 40744, 40819, 41311, 41971, 42102, 42616, 43055, 43211, 43234, 43428, 43494, 43934, 44117, 44252, 44272, 44301, 44336, 44619, 44866, 44888, 45049, 45197, 45412, 45718, 46694, 46736, 47000, 48046, 48540, 49078, 49109, 49216, 49388, 49464, 50056, 50155, 50217, 50477, 50692, 51122, 51445, 51946, 52475, 52537, 52982, 54011, 54031, 54160, 54963, 55000, 55537, 56080, 56163, 56282, 56760, 56787, 57102, 57727, 57871, 58101, 58558, 58882, 59902, 60225, 60397, 60501, 60619, 60703, 60890, 61075, 61894, 61944, 62322, 62337, 62380, 62413, 62729, 62766, 62923, 63010, 63234, 63977, 64127, 65359, 65428, 65542, 65750, 65863, 66184, 66636, 66712, 67201, 67439, 67953, 68133, 68854, 69251, 69959, 70107, 70725, 70768, 71081, 71099, 71948, 72013, 72377, 72400, 72420, 72735, 73000, 73015, 73142, 73223, 73455, 73717, 74049, 74492, 74854, 74941, 75142, 75399, 75464, 75587, 75618, 75642, 75887, 76357, 76651, 77199, 77302, 77456, 77579, 77601, 77649, 77668, 77694, 77745, 78006, 78010, 78178, 78335, 78656, 78729, 78808, 78824, 78844, 78945, 79416, 79471, 79915, 80077, 80111, 80189, 80262, 80409, 80470, 80529, 80539, 80838, 81272, 81513, 81658, 81740, 81743, 81762, 81843, 82001, 82070, 82106, 82342, 82472, 82719, 83670, 84009, 84151, 84299, 84430, 84450, 84460, 84945, 86411, 86443, 86446, 86668, 86942, 87286, 87317, 87624, 87785, 88023, 88517, 88696, 88787, 88868, 88977, 89206, 90108, 90440, 90734, 90802, 90849, 90920, 90931, 91011, 91031, 91133, 91777, 91949, 92162, 92494, 93012, 93172, 94300, 94517, 95142, 95410, 95559, 95859, 96112, 97255, 97787, 97986, 98240, 98817, 99050, 99198, 99222, 99241, 99295, 99326, 99335, 99503, 99603, 99643, 99803, 99968}"
This code removes first and last character of the string ("{" and "}" characters), splits values by "," and removes whitespaces using trimws. After that it moves the format to number.
If it happens your data actually is json, stick with the rjson package. This answer is assuming your data is not json (since rjson::fromjson throws an error on your data)
Try:
string <- "{1948, 2507, 2510, 7030, 7110, 9009, 00027, 00206, 00399, 00717, 00814, 00828, 00848, 00917, 01050, 01105, 01144, 02130, 02768, 03037, 03752, 03754, 04070, 04110, 05050, 05255, 05289, 05564, 05595, 06100, 06330, 06671, 07041, 07119, 07137, 07273, 07313, 07454, 07871, 08104, 08714, 08726, 08995, 09059, 09073, 09525, 09949, 09981, 10092, 10439, 10782, 11185, 11507, 11712, 11806, 11858, 11980, 12067, 12113, 12139, 12643, 13820, 14534, 15007, 15014, 15549, 15953, 16151, 16174, 16634, 16733, 16888, 17111, 17207, 17377, 17721, 17900, 18118, 18400, 18686, 18880, 19080, 19342, 19444, 19772, 19790, 19891, 20091, 20245, 20402, 20811, 21114, 21345, 21811, 21881, 22222, 22311, 22320, 22831, 22969, 23251, 23572, 23734, 23862, 23889, 24034, 24463, 25172, 25688, 26143, 26221, 26803, 26850, 26898, 27497, 28291, 28343, 29411, 29419, 30024, 30561, 30923, 31345, 31351, 31555, 31927, 32198, 32861, 33020, 33040, 33095, 33188, 33311, 33368, 33377, 33475, 33519, 33574, 33592, 34207, 34235, 34272, 34484, 34854, 34872, 34875, 34876, 34880, 35222, 35292, 35344, 36177, 36266, 37038, 37060, 37548, 37686, 37700, 38139, 39368, 39369, 39633, 40132, 40698, 40704, 40744, 40819, 41311, 41971, 42102, 42616, 43055, 43211, 43234, 43428, 43494, 43934, 44117, 44252, 44272, 44301, 44336, 44619, 44866, 44888, 45049, 45197, 45412, 45718, 46694, 46736, 47000, 48046, 48540, 49078, 49109, 49216, 49388, 49464, 50056, 50155, 50217, 50477, 50692, 51122, 51445, 51946, 52475, 52537, 52982, 54011, 54031, 54160, 54963, 55000, 55537, 56080, 56163, 56282, 56760, 56787, 57102, 57727, 57871, 58101, 58558, 58882, 59902, 60225, 60397, 60501, 60619, 60703, 60890, 61075, 61894, 61944, 62322, 62337, 62380, 62413, 62729, 62766, 62923, 63010, 63234, 63977, 64127, 65359, 65428, 65542, 65750, 65863, 66184, 66636, 66712, 67201, 67439, 67953, 68133, 68854, 69251, 69959, 70107, 70725, 70768, 71081, 71099, 71948, 72013, 72377, 72400, 72420, 72735, 73000, 73015, 73142, 73223, 73455, 73717, 74049, 74492, 74854, 74941, 75142, 75399, 75464, 75587, 75618, 75642, 75887, 76357, 76651, 77199, 77302, 77456, 77579, 77601, 77649, 77668, 77694, 77745, 78006, 78010, 78178, 78335, 78656, 78729, 78808, 78824, 78844, 78945, 79416, 79471, 79915, 80077, 80111, 80189, 80262, 80409, 80470, 80529, 80539, 80838, 81272, 81513, 81658, 81740, 81743, 81762, 81843, 82001, 82070, 82106, 82342, 82472, 82719, 83670, 84009, 84151, 84299, 84430, 84450, 84460, 84945, 86411, 86443, 86446, 86668, 86942, 87286, 87317, 87624, 87785, 88023, 88517, 88696, 88787, 88868, 88977, 89206, 90108, 90440, 90734, 90802, 90849, 90920, 90931, 91011, 91031, 91133, 91777, 91949, 92162, 92494, 93012, 93172, 94300, 94517, 95142, 95410, 95559, 95859, 96112, 97255, 97787, 97986, 98240, 98817, 99050, 99198, 99222, 99241, 99295, 99326, 99335, 99503, 99603, 99643, 99803, 99968}"
string as list of characters:
string_as_list_char <- as.list(strsplit(gsub('\\{|\\}', '', string), ", "))[[1]]
or converted to numeric:
string_as_list_num <- as.list(as.numeric(strsplit(gsub('\\{|\\}', '', string), ", ")[[1]]))

Incontinuous Quaternion Signals

I'm using a BNO055 IMU and I sometimes see "jumps" in the quaternion signals during the movement. Is this normal? Here's a sample plot.
The first plot is the scalar value and the rest are the three vector components.
I assumed this happens to Euler Angles but not in Quaternions. Is there something I'm missing?
0.4978 0.37885 0.65814 -0.41888
0.49774 0.37854 0.65778 -0.41986
0.49762 0.37842 0.65759 -0.42035
0.49878 0.37616 0.6582 -0.42017
0.49878 0.37561 0.65784 -0.42114
0.49872 0.37537 0.65765 -0.42175
0.49933 0.3736 0.65802 -0.42206
0.49902 0.37347 0.65753 -0.42328
0.49896 0.37335 0.65735 -0.42371
0.49921 0.37189 0.6579 -0.42383
0.49872 0.37164 0.65771 -0.42499
0.49841 0.37158 0.65784 -0.42517
0.49854 0.37042 0.65881 -0.42444
0.49792 0.37042 0.65936 -0.42444
0.4975 0.37048 0.65961 -0.42456
0.49768 0.36932 0.66034 -0.42413
0.49701 0.36957 0.66034 -0.42468
0.49664 0.36975 0.66022 -0.42511
0.49719 0.36823 0.66083 -0.42487
0.49658 0.36877 0.66028 -0.42596
0.49622 0.36908 0.65991 -0.42664
0.49683 0.3678 0.66034 -0.42645
0.49609 0.36841 0.65973 -0.42767
0.49573 0.36871 0.65948 -0.42822
0.49658 0.36713 0.66003 -0.42773
0.49591 0.36768 0.65948 -0.42889
0.49554 0.36798 0.65918 -0.4295
0.49658 0.36572 0.66016 -0.42877
0.49554 0.36639 0.65942 -0.43048
0.49493 0.36676 0.659 -0.43158
0.49426 0.36682 0.65857 -0.43292
0.49316 0.36774 0.65765 -0.43475
0.49274 0.36816 0.65723 -0.43555
0.49261 0.36768 0.65717 -0.43616
0.49188 0.3681 0.65662 -0.43744
0.49152 0.36829 0.65643 -0.43805
0.4917 0.36719 0.65662 -0.43842
0.49091 0.36749 0.65619 -0.43976
0.49048 0.36768 0.65594 -0.44043
0.4903 0.36707 0.65607 -0.44098
0.48956 0.36713 0.65582 -0.44208
0.48926 0.36707 0.65576 -0.44257
0.48944 0.36591 0.65619 -0.44263
0.48926 0.36542 0.65631 -0.44312
0.48914 0.36511 0.65649 -0.44324
0.48962 0.36328 0.65741 -0.44281
0.48956 0.3623 0.6579 -0.44293
0.48956 0.36176 0.6582 -0.44299
0.4903 0.35937 0.65936 -0.44238
0.48993 0.35846 0.65967 -0.44305
0.48969 0.35815 0.65979 -0.44348
0.4903 0.35614 0.66077 -0.44287
0.48975 0.35596 0.66095 -0.44336
0.48956 0.35583 0.66101 -0.44354
0.48999 0.35449 0.66168 -0.44312
0.48969 0.35437 0.66174 -0.4436
0.48944 0.35431 0.66174 -0.44385
0.48932 0.35382 0.66193 -0.44409
0.48907 0.35364 0.66199 -0.44446
0.48895 0.35358 0.66199 -0.44464
0.48914 0.35272 0.66211 -0.44482
0.48883 0.35284 0.66193 -0.44543
0.48865 0.35297 0.6618 -0.4458
0.48938 0.35162 0.66229 -0.44519
0.48914 0.35193 0.66205 -0.44562
0.48901 0.35205 0.66199 -0.44574
0.48993 0.35059 0.66278 -0.44476
0.48999 0.35028 0.66309 -0.44446
0.49011 0.3501 0.66321 -0.44427
0.49097 0.34845 0.66425 -0.44305
0.49103 0.34814 0.66467 -0.44263
0.49103 0.34802 0.66486 -0.44238
0.49133 0.34747 0.66553 -0.44153
0.49152 0.34711 0.66608 -0.4408
0.49164 0.34686 0.66638 -0.44037
0.49274 0.34515 0.66766 -0.43854
0.49286 0.34473 0.66827 -0.43781
0.49298 0.34448 0.66858 -0.43744
0.49408 0.34259 0.66998 -0.43549
0.49445 0.34204 0.67065 -0.43451
0.49457 0.34174 0.67102 -0.43402
0.49518 0.34064 0.67194 -0.43274
0.49536 0.34015 0.67249 -0.43213
0.49536 0.3399 0.67273 -0.43188
0.49652 0.33789 0.67395 -0.43024
0.49652 0.33771 0.67426 -0.42987
0.49652 0.33765 0.67438 -0.42969
0.49738 0.33612 0.67535 -0.42834
0.49738 0.336 0.67566 -0.42804
0.49744 0.33588 0.67572 -0.42792
0.49835 0.33429 0.6767 -0.42664
0.49829 0.33423 0.67688 -0.42645
0.49829 0.33423 0.67694 -0.42633
0.49902 0.33276 0.67767 -0.42542
0.4989 0.3327 0.67767 -0.4256
0.49878 0.3327 0.67767 -0.42572
0.49908 0.33197 0.6781 -0.42535
0.49884 0.33209 0.67798 -0.42572
0.49872 0.33221 0.67786 -0.4259
0.49847 0.33228 0.67786 -0.42615
0.49835 0.3324 0.67786 -0.42627
0.49817 0.33252 0.67773 -0.42664
0.4986 0.33179 0.67798 -0.42627
0.49847 0.33185 0.67786 -0.42651
0.49823 0.33191 0.67773 -0.42694
0.4986 0.33105 0.67804 -0.4267
0.49854 0.33112 0.67798 -0.42682
0.49835 0.3313 0.67773 -0.42725
0.49829 0.33112 0.67767 -0.42761
0.49811 0.33118 0.67755 -0.42792
0.49786 0.33118 0.67743 -0.42841
0.49872 0.32953 0.6781 -0.42761
0.49866 0.32947 0.67804 -0.4278
0.49847 0.32947 0.67804 -0.42804
0.49847 0.32922 0.6781 -0.4281
0.49847 0.32922 0.67816 -0.42816
0.49841 0.32898 0.67822 -0.4281
0.49957 0.32697 0.67914 -0.42694
0.49957 0.32684 0.6792 -0.42694
0.49957 0.3266 0.67938 -0.42682
0.50031 0.32544 0.67993 -0.4259
0.50037 0.32532 0.68005 -0.42578
0.50049 0.32495 0.6803 -0.4256
0.50159 0.32306 0.68121 -0.42426
0.50165 0.32288 0.68127 -0.42413
0.50183 0.32251 0.68146 -0.42401
0.50256 0.32129 0.68207 -0.4231
0.50262 0.32117 0.68213 -0.42303
0.50269 0.32092 0.68219 -0.42291
0.50281 0.3208 0.68213 -0.42297
0.50287 0.32074 0.68213 -0.42303
0.50293 0.32068 0.68201 -0.42322
0.50323 0.32019 0.68207 -0.4231
0.50323 0.32019 0.68195 -0.42328
0.50323 0.32025 0.68182 -0.42346
0.50385 0.31934 0.68213 -0.42291
0.50385 0.31934 0.68207 -0.42303
0.50391 0.31934 0.68188 -0.42322
0.50513 0.31738 0.68268 -0.42194
0.50519 0.31738 0.68262 -0.42206
0.50513 0.31744 0.6825 -0.42218
0.50537 0.31708 0.68262 -0.42206
0.50537 0.31714 0.68256 -0.42212
0.50543 0.31708 0.6825 -0.42212
0.50629 0.31567 0.68311 -0.4212
0.50629 0.31567 0.68311 -0.4212
0.50629 0.31567 0.68304 -0.4212
0.50684 0.31482 0.68347 -0.42059
0.50696 0.31458 0.68359 -0.42035
0.50702 0.31451 0.68365 -0.42029
0.50757 0.3136 0.68402 -0.41974
0.50757 0.3136 0.68396 -0.41974
0.50763 0.3136 0.68396 -0.41974
0.50806 0.31287 0.68427 -0.41925
0.50806 0.31281 0.68427 -0.41925
0.50812 0.31281 0.68427 -0.41931
0.50867 0.31183 0.68469 -0.41858
0.50873 0.31183 0.68469 -0.41858
0.50873 0.31183 0.68469 -0.41858
0.50916 0.31104 0.685 -0.41803
0.50922 0.31104 0.685 -0.41803
0.50922 0.31104 0.685 -0.41803
0.51013 0.30957 0.68561 -0.41699
0.51013 0.30957 0.68561 -0.41699
0.51013 0.30957 0.68561 -0.41699
0.51044 0.30902 0.68579 -0.41663
0.51044 0.30902 0.68579 -0.41669
0.51044 0.30902 0.68579 -0.41669
0.51111 0.30792 0.68628 -0.41589
0.51117 0.30792 0.68622 -0.41589
0.51135 0.30768 0.68628 -0.41577
0.51135 0.30768 0.68628 -0.41577
0.51135 0.30762 0.68622 -0.41583
0.51208 0.3064 0.68677 -0.41498
0.51208 0.3064 0.68677 -0.41498
0.51215 0.30627 0.68683 -0.41492
0.51312 0.30463 0.68756 -0.4137
0.51324 0.3045 0.68756 -0.41364
0.51324 0.3045 0.68756 -0.41364
0.51385 0.30341 0.68799 -0.4129
0.51392 0.30341 0.68799 -0.41296
0.51392 0.30334 0.68799 -0.41296
0.51428 0.3028 0.68811 -0.41266
0.51434 0.30273 0.68805 -0.41272
0.51483 0.302 0.68835 -0.41223
0.51483 0.302 0.68835 -0.41223
0.51483 0.30194 0.68835 -0.41229
0.51495 0.30176 0.68842 -0.41217
0.51501 0.3017 0.68835 -0.41217
0.51501 0.3017 0.68835 -0.41223
0.51526 0.30139 0.68842 -0.41211
0.51526 0.30133 0.68842 -0.41211
0.51526 0.30133 0.68835 -0.41211
0.51593 0.30023 0.68872 -0.41144
0.51593 0.30023 0.68872 -0.41144
0.51611 0.29999 0.68878 -0.41132
0.51617 0.29987 0.68872 -0.41144
0.51617 0.29993 0.6886 -0.41162
0.51691 0.29865 0.68903 -0.41095
0.51691 0.29858 0.68896 -0.41101
0.51691 0.29846 0.68896 -0.41113
0.51703 0.29834 0.68884 -0.41125
0.51715 0.29822 0.68872 -0.41138
0.51721 0.2981 0.68872 -0.41144
0.51746 0.29767 0.68878 -0.41138
0.51752 0.29742 0.68878 -0.41144
0.51746 0.29761 0.6886 -0.41174
0.51752 0.29761 0.68854 -0.4118
0.51752 0.29761 0.68854 -0.4118
0.51776 0.2973 0.68854 -0.41162
0.51776 0.2973 0.68854 -0.41162
0.51776 0.2973 0.68854 -0.41162
0.5177 0.29736 0.68848 -0.41174
0.5177 0.2973 0.68848 -0.4118
0.51776 0.29724 0.68842 -0.41187
0.51831 0.29633 0.68872 -0.41138
0.51837 0.29639 0.68866 -0.41144
0.51831 0.29639 0.68854 -0.41156
0.51874 0.29559 0.68884 -0.41119
0.51874 0.29547 0.68884 -0.41125
0.51892 0.29517 0.68878 -0.41125
0.51898 0.29504 0.68878 -0.41132
0.51923 0.2948 0.68854 -0.41156
0.51959 0.29443 0.68829 -0.4118
0.52008 0.2937 0.68835 -0.41156
0.52032 0.29352 0.68799 -0.41205
0.52032 0.2937 0.68726 -0.41315
0.52045 0.2937 0.68695 -0.41351
0.52051 0.29388 0.68616 -0.41455
0.52063 0.2937 0.68585 -0.41504
0.52112 0.29291 0.68518 -0.41608
0.52179 0.29218 0.68427 -0.41736
0.52252 0.29144 0.68317 -0.4187
0.52313 0.29077 0.68274 -0.41913
0.5238 0.29041 0.68152 -0.42053
0.52417 0.29016 0.68103 -0.42102
0.52472 0.28906 0.68085 -0.42133
0.52545 0.28772 0.68066 -0.42163
0.52637 0.28619 0.68048 -0.42187
0.52692 0.2854 0.68036 -0.42194
0.52808 0.28381 0.67999 -0.42212
0.5293 0.28247 0.67957 -0.42224
0.52997 0.2818 0.67926 -0.42224
0.53107 0.28058 0.67908 -0.422
0.53223 0.27924 0.67908 -0.42151
0.53296 0.27838 0.67902 -0.42126
0.53479 0.27637 0.67871 -0.42065
0.53583 0.27521 0.67853 -0.42035
0.53796 0.27264 0.67828 -0.41974
0.53998 0.27008 0.67816 -0.41907
0.54102 0.26874 0.67816 -0.41852
0.54321 0.26575 0.67834 -0.4173
0.54559 0.26257 0.67853 -0.41589
0.54687 0.26099 0.67853 -0.41522
0.54944 0.25824 0.6781 -0.41425
0.55151 0.25665 0.67694 -0.41437
0.55225 0.25641 0.67615 -0.41479
0.55341 0.25647 0.67456 -0.41583
0.55475 0.25623 0.67291 -0.41687
0.55554 0.25574 0.67224 -0.41718
0.55768 0.25403 0.67126 -0.41699
0.56042 0.25128 0.67096 -0.41547
0.56183 0.24976 0.67078 -0.41473
0.56439 0.24719 0.67017 -0.41382
0.56616 0.24554 0.66949 -0.41351
0.56683 0.24518 0.66901 -0.41357
0.56769 0.24554 0.6676 -0.41443
0.56818 0.24713 0.66547 -0.41626
0.56836 0.24817 0.66418 -0.41742
0.56854 0.25073 0.66156 -0.41974
0.56873 0.25354 0.65955 -0.42108
0.56891 0.25476 0.65875 -0.42126
0.5697 0.25684 0.65747 -0.42096
0.57098 0.25903 0.6557 -0.42065
0.57178 0.26038 0.65442 -0.42078
0.57239 0.26373 0.65234 -0.42102
0.57269 0.26721 0.65015 -0.42181
0.57275 0.26843 0.64923 -0.42236
0.57288 0.26941 0.64801 -0.42346
0.57306 0.26898 0.64758 -0.42413
0.57312 0.26855 0.64746 -0.42444
0.57184 0.27045 0.6463 -0.42676
0.57355 0.26825 0.64636 -0.42584
0.57391 0.26746 0.64661 -0.42542
0.57349 0.26819 0.64587 -0.42664
0.57361 0.2691 0.64459 -0.4278
0.57397 0.26953 0.64362 -0.42859
0.57294 0.27289 0.64032 -0.43274
0.573 0.27423 0.63849 -0.43457
0.573 0.27484 0.63757 -0.43542
0.5708 0.27911 0.6347 -0.43976
0.57092 0.27991 0.63336 -0.44098
0.57111 0.28027 0.63251 -0.44177
0.56897 0.28424 0.62958 -0.44623
0.56915 0.284 0.62891 -0.44708
0.56927 0.28369 0.62878 -0.44727
0.56726 0.28619 0.62744 -0.4502
0.56763 0.28564 0.62714 -0.45044
0.56805 0.28503 0.62701 -0.45044
0.5675 0.2854 0.6261 -0.45227
0.56848 0.28333 0.62604 -0.45239
0.56866 0.28247 0.62616 -0.45251
0.56769 0.28217 0.62659 -0.45337
0.56726 0.28119 0.6283 -0.45215
0.56708 0.2807 0.62885 -0.45184
0.56567 0.28143 0.62878 -0.45325
0.56604 0.27985 0.62964 -0.45251
0.56616 0.27917 0.63025 -0.45203
0.56543 0.27887 0.63123 -0.45172
0.56567 0.27686 0.63306 -0.45013
0.56598 0.27563 0.63379 -0.44946
0.5658 0.27448 0.6344 -0.44946
0.56628 0.2724 0.63611 -0.44781
0.56659 0.27118 0.63727 -0.44653
0.56708 0.26874 0.63953 -0.44403
0.56818 0.26556 0.64203 -0.44092
0.56873 0.2641 0.64325 -0.43933
0.56915 0.26257 0.64496 -0.43726
0.57025 0.26038 0.64691 -0.43414
0.57074 0.25952 0.64783 -0.43268
0.57086 0.25867 0.64954 -0.43048
0.57135 0.25714 0.65149 -0.4278
0.57159 0.25653 0.6524 -0.42651
0.57104 0.2569 0.65356 -0.42517
0.57129 0.25616 0.65564 -0.42206
0.57141 0.25586 0.65692 -0.4201
0.57159 0.25543 0.65936 -0.41626
0.5719 0.2547 0.66162 -0.41272
0.57196 0.25446 0.6626 -0.41119
0.57208 0.25403 0.66449 -0.40826
0.57214 0.25354 0.66687 -0.40454
0.57208 0.25342 0.66809 -0.40271
0.57062 0.25488 0.66968 -0.40125
0.56921 0.25592 0.67133 -0.39978
0.5683 0.25677 0.67206 -0.39935
0.56525 0.2616 0.67236 -0.40002
0.56299 0.26532 0.67297 -0.39978
0.56158 0.26733 0.67297 -0.40033
0.55786 0.27264 0.67212 -0.40338
0.55432 0.27722 0.67145 -0.40631
0.55249 0.27942 0.67126 -0.40759
0.54889 0.28461 0.66992 -0.41101
0.54651 0.2879 0.66919 -0.41315
0.5451 0.28949 0.66895 -0.41418
0.54254 0.29254 0.66864 -0.41595
0.54034 0.29553 0.66833 -0.41718
0.53931 0.29736 0.66791 -0.41791
0.53687 0.30176 0.66681 -0.41962
0.53387 0.30634 0.66577 -0.42175
0.5321 0.30859 0.66534 -0.42303
0.52856 0.31238 0.66473 -0.4256
0.52563 0.31519 0.66443 -0.42761
0.5246 0.31622 0.66443 -0.42816
0.52313 0.31769 0.66486 -0.42828
0.52216 0.31873 0.66565 -0.42743
0.52179 0.31909 0.6662 -0.42676
0.52112 0.31976 0.6673 -0.42529
0.52039 0.3205 0.66827 -0.42419
0.51996 0.32104 0.66852 -0.42389
0.51874 0.32245 0.66882 -0.42383
0.51733 0.32391 0.6687 -0.4245
0.51666 0.32471 0.66858 -0.42505
0.5152 0.32599 0.66833 -0.42609
0.51385 0.32715 0.66827 -0.42706
0.51324 0.32745 0.66833 -0.42743
0.51227 0.32776 0.6687 -0.4278
0.5116 0.32776 0.66925 -0.42767
0.51141 0.3277 0.66956 -0.42761
0.51093 0.32733 0.6701 -0.42743
0.51031 0.32709 0.67065 -0.42755
0.51001 0.32709 0.67084 -0.42773
0.50909 0.32733 0.67096 -0.42841
0.508 0.32782 0.6709 -0.42938
0.50745 0.32794 0.67084 -0.43005
0.50702 0.32733 0.67114 -0.43054
0.50604 0.32776 0.6712 -0.43127
0.50562 0.32794 0.67126 -0.43152
0.50586 0.32654 0.67224 -0.43079
0.50562 0.32642 0.67224 -0.43115
0.50537 0.32629 0.67242 -0.43127
0.50549 0.32495 0.67322 -0.43097
0.50488 0.32428 0.67389 -0.43109
0.50452 0.32391 0.67426 -0.43121
0.50439 0.32184 0.67542 -0.43109
0.50311 0.32098 0.67566 -0.43286
0.50238 0.32056 0.67554 -0.43414
0.50183 0.31818 0.67548 -0.43658
0.50055 0.31628 0.67438 -0.44116
0.49969 0.31531 0.67346 -0.44421
0.49823 0.31213 0.67163 -0.45087
0.49438 0.31024 0.66888 -0.46033
0.49249 0.30884 0.66748 -0.46533
0.48987 0.3031 0.66595 -0.47394
0.48523 0.29797 0.66522 -0.48297
0.48248 0.29517 0.66498 -0.48773
0.47675 0.28815 0.66461 -0.49799
0.46942 0.28113 0.66376 -0.50995
0.46552 0.27704 0.66351 -0.51599
0.45862 0.26611 0.66443 -0.52661
0.45184 0.25269 0.66528 -0.53796
0.44836 0.24542 0.66553 -0.54382
0.44214 0.23041 0.66595 -0.55487
0.43695 0.21545 0.66516 -0.56586
0.43469 0.20819 0.66406 -0.57159
0.43048 0.19226 0.66223 -0.5824
0.42621 0.1734 0.6618 -0.59186
0.42346 0.16333 0.66248 -0.59595
0.41821 0.14209 0.66461 -0.60266
0.41278 0.11896 0.66742 -0.60834
0.40973 0.10706 0.66864 -0.61127
0.4032 0.08392 0.67041 -0.61719
0.396 0.06049 0.67145 -0.62341
0.39233 0.04865 0.67187 -0.62628
0.38403 0.02545 0.67358 -0.63098
0.37476 0.00323 0.67542 -0.63513
0.37018 -0.00739 0.67584 -0.63733
0.36084 -0.02777 0.67633 -0.64154
0.3512 -0.04767 0.67682 -0.6452
0.34644 -0.05725 0.67688 -0.64691
0.33783 -0.07623 0.67627 -0.65015
0.32916 -0.09412 0.6756 -0.65295
0.32483 -0.10278 0.67523 -0.65417
0.31628 -0.11951 0.67438 -0.65643
0.30859 -0.13525 0.67346 -0.65796
0.30524 -0.14301 0.67303 -0.65839
0.29883 -0.15735 0.67212 -0.65894
0.29285 -0.17017 0.67084 -0.65973
0.29016 -0.17627 0.67004 -0.6601
0.28577 -0.18774 0.66852 -0.66046
0.28168 -0.19818 0.6673 -0.6604
0.2796 -0.20319 0.66681 -0.66022
0.27612 -0.21216 0.66632 -0.65936
0.27332 -0.21948 0.66602 -0.65845
0.27197 -0.22217 0.66595 -0.65814
0.26971 -0.22528 0.66638 -0.65759
0.26965 -0.2262 0.66724 -0.65643
0.27045 -0.22577 0.66772 -0.65576
0.27319 -0.22284 0.66895 -0.65442
0.27765 -0.21875 0.67047 -0.65234
0.28021 -0.216 0.6712 -0.65137
0.28564 -0.20801 0.67273 -0.65009
0.29242 -0.19879 0.67462 -0.64801
0.29602 -0.19415 0.6756 -0.64667
0.30304 -0.18378 0.67767 -0.64435
0.31012 -0.17163 0.67938 -0.64252
0.31396 -0.16516 0.67981 -0.64191
0.32214 -0.15137 0.68018 -0.64081
0.33002 -0.13611 0.68066 -0.63971
0.33392 -0.12799 0.68103 -0.63898
0.34253 -0.11212 0.68109 -0.63739
0.35144 -0.0957 0.6795 -0.6369
0.35565 -0.0871 0.67853 -0.63678
0.36462 -0.06873 0.67621 -0.63641
0.37415 -0.05145 0.6734 -0.63556
0.37714 -0.04175 0.67322 -0.6347
0.38361 -0.02252 0.67169 -0.63336
0.3913 -0.0036 0.66858 -0.63239
0.39618 0.0047 0.66656 -0.63141
0.40436 0.02069 0.66473 -0.62781
0.40839 0.04364 0.66541 -0.62329
0.40979 0.05762 0.66559 -0.62103
0.41833 0.08002 0.66089 -0.61792
0.42279 0.09088 0.65839 -0.61603
0.42828 0.11566 0.65662 -0.60992
0.42963 0.14301 0.65747 -0.60223
0.42999 0.1557 0.65765 -0.59863
0.43103 0.17578 0.65833 -0.59155
0.43188 0.19214 0.66113 -0.58264
0.43396 0.19739 0.6629 -0.57733
0.44061 0.20557 0.66614 -0.56561
0.44531 0.21387 0.66895 -0.55536
0.44952 0.2215 0.6712 -0.54626
0.45117 0.22516 0.6723 -0.54199
0.45361 0.23413 0.67395 -0.53406
0.45398 0.23975 0.67493 -0.52997
0.45251 0.25287 0.67804 -0.52112
0.4516 0.26282 0.68158 -0.51227
0.45349 0.2652 0.68262 -0.508
0.45825 0.26947 0.68335 -0.50043
0.46191 0.27368 0.68396 -0.49396
0.46289 0.27582 0.68439 -0.49121
0.46259 0.28119 0.68542 -0.48694
0.46167 0.2887 0.68579 -0.48291
0.46191 0.29266 0.68524 -0.48108
0.46417 0.29999 0.68231 -0.47858
0.46539 0.30841 0.67859 -0.47729
0.46466 0.31329 0.67706 -0.47693
0.46198 0.32349 0.67401 -0.47711
0.46185 0.32941 0.6712 -0.47711
0.46277 0.33087 0.67059 -0.47614
0.46405 0.33325 0.67102 -0.4726
0.46539 0.33508 0.67358 -0.46625
0.46698 0.33557 0.67523 -0.46191
0.47168 0.33514 0.67834 -0.45276
0.47717 0.33417 0.67969 -0.44568
0.47937 0.33356 0.68011 -0.44318
0.48199 0.33136 0.68127 -0.44019
0.48431 0.32794 0.68188 -0.43927
0.48547 0.32648 0.68182 -0.43921
0.4873 0.32458 0.68134 -0.43921
0.48773 0.32434 0.68109 -0.43939
0.48767 0.32446 0.68085 -0.4397
0.48846 0.32416 0.68005 -0.44025
0.48926 0.32361 0.67963 -0.44049
0.48975 0.32312 0.6795 -0.44043
0.49103 0.32172 0.67944 -0.44019
0.49237 0.32007 0.67926 -0.44012
0.49292 0.31934 0.67914 -0.44025
0.49414 0.31812 0.67834 -0.44104
0.49463 0.31793 0.67725 -0.4422
0.49487 0.31805 0.6767 -0.44275
0.49548 0.31818 0.6756 -0.4436
0.49634 0.31781 0.67487 -0.44415
0.49689 0.31726 0.67462 -0.44421
0.49805 0.31561 0.67462 -0.44403
0.49921 0.31378 0.6748 -0.44379
0.49988 0.31293 0.67487 -0.4436
0.50128 0.31134 0.6748 -0.44324
0.50238 0.31042 0.67444 -0.44318
0.50281 0.31012 0.67426 -0.44318
0.50348 0.30969 0.67389 -0.44324
0.50397 0.30939 0.67352 -0.44354
0.50415 0.3092 0.67334 -0.44373
0.50458 0.30896 0.67273 -0.44427
0.50531 0.30853 0.67187 -0.44501
0.50568 0.30835 0.67163 -0.44513
0.50665 0.30762 0.67084 -0.44574
0.50751 0.30713 0.66956 -0.44702
0.50793 0.30707 0.66858 -0.44806
0.50867 0.30731 0.66608 -0.45074
0.50909 0.30829 0.66278 -0.45441
0.50934 0.30872 0.66083 -0.45667
0.51007 0.30908 0.65643 -0.46198
0.51038 0.30896 0.65222 -0.46765
0.51031 0.30878 0.65045 -0.47028
0.5105 0.30786 0.64771 -0.47449
0.51129 0.30621 0.64624 -0.47662
0.51196 0.30518 0.646 -0.47693
0.51349 0.30286 0.6463 -0.47632
0.51569 0.29968 0.64752 -0.4743
0.51691 0.29779 0.64844 -0.4729
0.51953 0.29352 0.65094 -0.4693
0.52081 0.29114 0.65253 -0.4671
0.52386 0.2854 0.65594 -0.46246
0.52765 0.2793 0.65869 -0.45801
0.5296 0.27655 0.65936 -0.45636
0.53345 0.27191 0.65955 -0.45441
0.53693 0.26782 0.65869 -0.45392
0.53857 0.26581 0.65796 -0.45435
0.54034 0.26263 0.6571 -0.45526
0.54236 0.26007 0.65692 -0.45453
0.54352 0.25946 0.65674 -0.45386
0.54492 0.26013 0.65503 -0.45422
0.5448 0.26294 0.65216 -0.45685
0.54395 0.26538 0.65045 -0.45892
0.54181 0.2713 0.64679 -0.46313
0.5401 0.27765 0.64331 -0.46619
0.53973 0.28064 0.64154 -0.46722
0.53998 0.2865 0.63739 -0.46912
0.53943 0.29291 0.63324 -0.47137
0.53857 0.29663 0.63116 -0.4729
0.53644 0.30487 0.62622 -0.4765
0.53375 0.31268 0.62103 -0.48126
0.53174 0.31659 0.61926 -0.48328
0.52832 0.32239 0.61633 -0.48694
0.52606 0.32477 0.61389 -0.49084
0.52527 0.32562 0.61298 -0.49231
0.52478 0.32556 0.61182 -0.49432
0.52557 0.3244 0.61115 -0.49506
0.52643 0.32336 0.61121 -0.49469
0.52979 0.32007 0.6106 -0.49402
0.53363 0.31647 0.60901 -0.49414
0.53546 0.31506 0.60791 -0.49445
0.53809 0.31287 0.6059 -0.49542
0.53998 0.31116 0.60388 -0.49695
0.54065 0.31055 0.60284 -0.4978
0.54126 0.31018 0.60059 -0.50012
0.54132 0.31097 0.59772 -0.50299
0.5412 0.31158 0.5965 -0.50427
0.54089 0.31238 0.59497 -0.5058
0.54059 0.31262 0.59424 -0.50684
0.54053 0.31268 0.59393 -0.5072
0.54102 0.31238 0.59332 -0.50769
0.54187 0.31134 0.59344 -0.50726
0.54242 0.31055 0.59369 -0.5069
0.54327 0.3092 0.59387 -0.50653
0.54382 0.3078 0.59467 -0.50586
0.54407 0.30707 0.59546 -0.50513
0.54456 0.30591 0.59686 -0.50366
0.54474 0.30518 0.59827 -0.5022
0.54468 0.30505 0.59924 -0.50122
0.54431 0.30499 0.60114 -0.49933
0.54395 0.3053 0.6026 -0.4978
0.54382 0.30542 0.60333 -0.49701
0.54352 0.30518 0.60541 -0.49493
0.5434 0.30499 0.60779 -0.49219
0.54352 0.30481 0.60889 -0.49084
0.54382 0.30444 0.61047 -0.48883
0.54395 0.30396 0.61163 -0.48755
0.54395 0.30383 0.6123 -0.48669
0.54431 0.30328 0.61456 -0.48376
0.54456 0.3028 0.61694 -0.48083
0.54449 0.3028 0.61761 -0.47992
0.54456 0.30292 0.61847 -0.47876
0.54456 0.30292 0.6192 -0.47772
0.54431 0.30273 0.62177 -0.47485
0.54413 0.3028 0.62378 -0.47235
0.54437 0.30267 0.62445 -0.47131
0.54523 0.30194 0.62592 -0.46881
0.54602 0.30078 0.62866 -0.46497
0.5462 0.30011 0.63055 -0.46265
0.54669 0.29919 0.63403 -0.45782
0.54767 0.29803 0.63696 -0.45343
0.5481 0.29718 0.63843 -0.45129
0.54889 0.29541 0.64142 -0.44727
0.54907 0.29413 0.64478 -0.44305
0.54895 0.29395 0.6463 -0.4411
0.54846 0.29443 0.6485 -0.43811
0.54724 0.29608 0.65027 -0.43591
0.54657 0.29706 0.651 -0.435
0.54523 0.29938 0.6521 -0.43341
0.54327 0.3017 0.65265 -0.43347
0.54144 0.30365 0.6535 -0.43317
0.53717 0.30774 0.65515 -0.43298
0.53357 0.31134 0.65625 -0.43329
0.53217 0.31281 0.65668 -0.43323
0.52972 0.31543 0.65796 -0.43243
0.52795 0.31738 0.65924 -0.43115
0.52722 0.31805 0.65997 -0.43048
0.52612 0.31873 0.66138 -0.42926
0.52545 0.3186 0.6626 -0.42822
0.52527 0.31836 0.66321 -0.42761
0.5249 0.31769 0.66467 -0.42633
0.52429 0.31726 0.66595 -0.42542
0.5238 0.31732 0.66644 -0.42523
0.52258 0.31763 0.66693 -0.4256
0.52136 0.31812 0.66742 -0.42609
0.52081 0.31836 0.66766 -0.42609
0.5199 0.31879 0.66864 -0.42542
0.5188 0.31927 0.66962 -0.4248
0.51819 0.31964 0.67004 -0.42474
0.51691 0.32043 0.67041 -0.42511
0.5155 0.32196 0.67017 -0.42603
0.51465 0.323 0.66992 -0.42664
0.51276 0.32538 0.66931 -0.42804
0.51068 0.32758 0.66882 -0.42957
0.50964 0.32849 0.66876 -0.4303
0.50793 0.32996 0.66876 -0.43115
0.50677 0.33093 0.66895 -0.43152
0.50629 0.33136 0.66907 -0.43158
0.50537 0.33209 0.66937 -0.43158
0.50452 0.33276 0.6698 -0.43146
0.50409 0.33307 0.66998 -0.43134
0.50336 0.3335 0.67059 -0.43091
Thanks
As #minorlogic also wrote in their comment, these jumps occur near the circular limits of (0,2pi] or (-pi,pi] -- or, in terms of unit quaternions (being constructed as [cos(phi), sin(phi) * rotAxis]), more appropriately in the range (-1,1] for each component.
Most IMUs however don't represent their orientation readings in a normalised fashion, though, but the normalisation factor(s) should be stated in the data sheet (as #daniel-wisehart mentioned in their comment). When applying these factors, you should obtain a quaternion representation with values between -1 and 1. These overflows will still be present, though, as these are basically a normalisation requirement (i.e. to keep the unit part of unit quaternions).

Subsetting xts objects - index functions not working

In an effort to subset an xts object, I am using the .index* family of functions (http://www.inside-r.org/packages/cran/xts/docs/indexClass) as shown in one of the answers to this question: Return data subset time frames within another timeframes?.
The sample xts object used in this example has 1000 hourly data points from 2015-12-29 to 2016-02-29. The code below attempts to create subsets for various time selection criteria. Some of the functions are not working: indexyear, indexweek, indexday and indexmin fail to produce any output (please note the rest of the functions work as intended). Would anyone know why? Thanks very much!
library(xts)
DATSxts <- structure(c(1069.4, 1070.7, 1070.4, 1070.3, 1068.7, 1068.7, 1069.4, 1069.7, 1069.5, 1068.1, 1069.3, 1069.2, 1069.3, 1070.7, 1070.9, 1070.7, 1070.8, 1070.5, 1070.5, 1069.7, 1068.9, 1070.2, 1067.3, 1067.8, 1067.9, 1061.7, 1060.8, 1061.7, 1060.9, 1060.2, 1060.9, 1061, 1060.3, 1061.2, 1061.9, 1062, 1061.9, 1062.5, 1062.3, 1062.3, 1062, 1062.7, 1063, 1062, 1062.6, 1062.4, 1061.8, 1058.9, 1061.5, 1062.4, 1061.4, 1060.9, 1062, 1060.6, 1059.4, 1060.5, 1061.3, 1063.1, 1064.6, 1063.5, 1064.3, 1063.7, 1065.3, 1068.7, 1069.8, 1071.3, 1072.8, 1073.8, 1072.9, 1072.7, 1072.6, 1078.8, 1080.6, 1078.2, 1073.7, 1076.4, 1075.2, 1075.4, 1075.4, 1074.7, 1073.2, 1076, 1076.5, 1076.2, 1077.1, 1077.6, 1078.5, 1079.1, 1077, 1077, 1078.1, 1077.7, 1080, 1079.7, 1075.6, 1077.2, 1077.2, 1080, 1080, 1078.8, 1079, 1078.9, 1077.8, 1078, 1077.7, 1076.1, 1077, 1078.4, 1078.6, 1079.5, 1080.5, 1082.1, 1083.3, 1083.5, 1085.6, 1085.2, 1088.8, 1085.1, 1090.5, 1088, 1091.1, 1091.4, 1094.3, 1094.4, 1094.2, 1094.1, 1093.1, 1093.1, 1097.6, 1098.7, 1098.2, 1100.1,
1099.4, 1100.1, 1097.6, 1096.1, 1097, 1096.4, 1098.5, 1100.8, 1101.8, 1106.4, 1103.5, 1106.4, 1109.5, 1108.7, 1110.4, 1109.8, 1109.5, 1109.9, 1109.1, 1104.3, 1105.2, 1104.1, 1103.5, 1104, 1102.9, 1101.7, 1099.8, 1096.8, 1098.6, 1100, 1100.1, 1100, 1101.9, 1103.7, 1103.8, 1101.2, 1098.9, 1103.1, 1104.6, 1104.9, 1107.2, 1107.1, 1106.1, 1105.2, 1104.5, 1104.4, 1105.6, 1107.4, 1106.7, 1100.8, 1100, 1104.4, 1103.4, 1104, 1101.4, 1102, 1100, 1098.9, 1099.6, 1097.3, 1096.8, 1095.4, 1094.5, 1096.3, 1095.4, 1095.8, 1096, 1097.4, 1098.4, 1096.3, 1095, 1095.4, 1096.9, 1095.4, 1092.3, 1091.6, 1087.8, 1089, 1085.8, 1088.8, 1086.8, 1086.8, 1087.5, 1090.3, 1090, 1086.8, 1087.1, 1086.6, 1086.2, 1085, 1084.4, 1083.9, 1085.7, 1085.9, 1082.9, 1082.7, 1081.7, 1082.7, 1083.3, 1083.2, 1082.2, 1088.7, 1089.5, 1092.4, 1091.6, 1093, 1094.4, 1095.2, 1094.1, 1095.8, 1094.5, 1093.1, 1093.7, 1093.1, 1095.4, 1092.3, 1091.5, 1089.1, 1092.5, 1092.4, 1091.4, 1092.3, 1086.1, 1084.8, 1088.7, 1082.9, 1082.6, 1078.4, 1073.6, 1076.9, 1077.6, 1079.1, 1077.7, 1078.6, 1078.8, 1080.4, 1081.2, 1081.5, 1081.1, 1083.6, 1084.9, 1084.2, 1083.9, 1081.3, 1082.4, 1084.6, 1094.6, 1094.1, 1091.1, 1090.7, 1090.8, 1090.3, 1089.3, 1088.8, 1089.4, 1091, 1091.5, 1091.9, 1093.3, 1092.4, 1093.1, 1090.9, 1090.6, 1091, 1089.3, 1091.8, 1091.2, 1090.5, 1091, 1090.6, 1089.8, 1089.7, 1090.1, 1089.7, 1089.3, 1089.1, 1086.4, 1090.6, 1090.3, 1089, 1089.3, 1089.5, 1090.8, 1093.3, 1089.5, 1087.8, 1084.7, 1085.3, 1086.7, 1086.8, 1086.9, 1087.7, 1090.1, 1090.8, 1088.3, 1087.9, 1088.1, 1088.6, 1090.1, 1092.2, 1091.6, 1093.3, 1093.3, 1091.9, 1092.7, 1094.8, 1096.3, 1094.1, 1095.5, 1095.9, 1102.5, 1100.5, 1101.9, 1102.8, 1104.3, 1106.8, 1105.6, 1104.5, 1102.7, 1101.8, 1100.4, 1099.7, 1100.7, 1100.3, 1100.9, 1103, 1104.3, 1103.8, 1104.1, 1101.4, 1099.7, 1098.3, 1100.2, 1100.6, 1098.6, 1097.2, 1095.7, 1095.4, 1096, 1101.8, 1101.6, 1103.5, 1102.2, 1101.7, 1100.3, 1100.4, 1100.1, 1102.1, 1100.6, 1099.8, 1099.5, 1097.8, 1096.4, 1098.1, 1098.7, 1099.1, 1098.9, 1096.2, 1097.3, 1101.3, 1100, 1099, 1097, 1097.8, 1098.8, 1099, 1099.1, 1099.3, 1101.3, 1102.1, 1102.9, 1103.1, 1101.9, 1102.3, 1105.2, 1104.3, 1105.7, 1105.1, 1107.5, 1105.4, 1107.9, 1107.4, 1107.5, 1108.8, 1107, 1106.4, 1106.5, 1109.6, 1108.9, 1109.7, 1109.4, 1110.9, 1112.2, 1114.1, 1113.5, 1113.5, 1115.9, 1117.3, 1115.2, 1114.5, 1114.9, 1112.7, 1113.2, 1114.2, 1114.9, 1119.6, 1118.8, 1119.6, 1122.1, 1123.1, 1122.6, 1120.7, 1120.5, 1121.4, 1121.3, 1122, 1122.3, 1121, 1121.5, 1120.4, 1119, 1118.4, 1119.7, 1117.9, 1118.9, 1119.8, 1119.4, 1117.6, 1117.2, 1117.5, 1118.2, 1117.3, 1128.3, 1126.4, 1125.7, 1125.3, 1122.8, 1120.6, 1121, 1122.3, 1121.1, 1120.3, 1118, 1118.5, 1119.3, 1118.2, 1118.9, 1122.1, 1120.3, 1120.8, 1114, 1115.9, 1116.5, 1116.1, 1115.8, 1115.9, 1114.3, 1115.6, 1114.6, 1114.8, 1116.3, 1114.9, 1112.7, 1115.7, 1114.6, 1115.5, 1113.4, 1111.7, 1113.4, 1112.8, 1112.1, 1115.4, 1113.5, 1112.4, 1118, 1117, 1117.1, 1116.6, 1116.5, 1117.9, 1118.4, 1117.8, 1118.4, 1120.4, 1121.4, 1122.5, 1122.3, 1122.3, 1121.8, 1122.9, 1122, 1122, 1123, 1121.8, 1123.9, 1122.9, 1126.4, 1126.3, 1126.7, 1127.2, 1127.6, 1128.8, 1129.7, 1128.6, 1128.6, 1129.5, 1127.6, 1127.4, 1126.1, 1125.8, 1125.8, 1125.9, 1126.1, 1126.4, 1125.8, 1125.2, 1124.8, 1125.4, 1127.4, 1128.9, 1128.3, 1125, 1126.3, 1128, 1128.3, 1130.1, 1129.6, 1127.9, 1127.6, 1128.4, 1128.7, 1127.8, 1127.1, 1128.5, 1128.5, 1124.9, 1126.8, 1128.2, 1130.4, 1128.6, 1130.2, 1126.7, 1132.5, 1138.2, 1138.6, 1140, 1144.2, 1138.9, 1142.8, 1143, 1142.6, 1143.5, 1141.8, 1141.3, 1141.2, 1141.8, 1143.5, 1143.9, 1142.4, 1145.4, 1146.4, 1147.6, 1145.8, 1148.2, 1153.5, 1155.3, 1152.1, 1154.6, 1155.9, 1155.5, 1156.4, 1156.4, 1156, 1156, 1156.1, 1154.8, 1156.4, 1156.1, 1155.7, 1155.3, 1154.8, 1154.8, 1156.3, 1157.9, 1159.4, 1159.4, 1159, 1151.5, 1149.9, 1154, 1155.3, 1157.6, 1157.9, 1162.8, 1174.5, 1174.1, 1174.1, 1165.3, 1168.5, 1165.4, 1165.5, 1166.2, 1166.7, 1166.2, 1166.4, 1165.8, 1168.5, 1173.8, 1176.4, 1175.9, 1182.5, 1182.1, 1192.1, 1193.6, 1194.4, 1195.6, 1201, 1195.5, 1190.7, 1189.6, 1191.5,
1193.2, 1193.9, 1194, 1193.2, 1193.1, 1191.8, 1193.4, 1186.7, 1188.7, 1189.5, 1189.3, 1191.7, 1196.6, 1198.5, 1189.7, 1195.5, 1195.6, 1197.3, 1195.2, 1190.8, 1187.9, 1189.4, 1189.6, 1192.1, 1193.4, 1191.5, 1191.3, 1191.8, 1191.8, 1191.2, 1188, 1187, 1182.3, 1182.6, 1182.8, 1183.7, 1187.9, 1191, 1192.6, 1193.3, 1192.1, 1192.5, 1194, 1196.9, 1197.4, 1197.4, 1199, 1208.7, 1208.4, 1207, 1206.1, 1209.3, 1206.7, 1208.2, 1207.6, 1217.6, 1217.6, 1224.8, 1237.3, 1235.9, 1236, 1233, 1247.1, 1254.5, 1248.4, 1249.4, 1245, 1245.1, 1247, 1240.7, 1238.6, 1236.3, 1238.2, 1233.9, 1233.5, 1239.3, 1245, 1242.6, 1239.5, 1238.4, 1242.6, 1238, 1238.7, 1236, 1239.5, 1238.4, 1237.8, 1236.9, 1239.3, 1238.7, 1238.5, 1238.5, 1233.8, 1228.1, 1223.7, 1224.7, 1221, 1220.6, 1219.8, 1219.5, 1212.4, 1210.1, 1209.5, 1210.2, 1209.9, 1209.6, 1211.7, 1210, 1205.7, 1207.4, 1209.4, 1208.4, 1208.4, 1204.7, 1198.4, 1193.4, 1194.2, 1197.9, 1201.3, 1196.2, 1200, 1211, 1212, 1215.4, 1213.9, 1215.3, 1211.2, 1216.4, 1213, 1209.1, 1204.2, 1204.2, 1200.4, 1200.9, 1203.2, 1198.2, 1202.6, 1203.7, 1209.3, 1209.1, 1206.8, 1207.3, 1211.5, 1204.6, 1202.9, 1203, 1202.3, 1207, 1209.4, 1210.9, 1210.6, 1212.8, 1210.2, 1210.3, 1208.9, 1208.3, 1209, 1207.4, 1209.3, 1209.1, 1210.5, 1210.1, 1209.5, 1209.9, 1208.1, 1207.5, 1207.6, 1206.8, 1203.4, 1204.3, 1205.8, 1206.9, 1210.8, 1215.8, 1218.8, 1227.8, 1232.9, 1234.7, 1237.5, 1231.3, 1231.6, 1232.8, 1227.2, 1227.5, 1228.4, 1228, 1226.7, 1226.5, 1224.4, 1224.2, 1221.5, 1222.9, 1230.8, 1231.7, 1230.7, 1229.3, 1231.6, 1233, 1231.3, 1231.9, 1232.7, 1229.6, 1226.6, 1226.1, 1225.9, 1223.5, 1223.3, 1217.1, 1216.3, 1217, 1217.7, 1211, 1209.5, 1206.6, 1205.2, 1204, 1207.6, 1209.1, 1212.6, 1212.2, 1210.3, 1211.1, 1209.2, 1208.2, 1207.9, 1208.9, 1209.3, 1211.2, 1215.8, 1215.7, 1221.1, 1220.5, 1216.6, 1216.7, 1217.8, 1216.9, 1219.2, 1218.8, 1217.4, 1219.3, 1218.6, 1221.6, 1225.6, 1224.6, 1223.8, 1222.8, 1223.6, 1226.1, 1226, 1231.1, 1230, 1225.9, 1228, 1228.6, 1228.7, 1228.1, 1226, 1224.2, 1226.2, 1230.6, 1237.1, 1238, 1236.1, 1244.4, 1250.2, 1248.6, 1245.6, 1238.4, 1239.7, 1230.5, 1230.3, 1229.4, 1225, 1228.5, 1236.3, 1233.3, 1234.4, 1233.4, 1234.5, 1237.2, 1241, 1239.5, 1237.4, 1236, 1233.3, 1236.5, 1234.8, 1236.4, 1239.2, 1239.8, 1242.1, 1235.1, 1239.1, 1233.6, 1233.7, 1234.5, 1237.5, 1239, 1237.6, 1236.5, 1238.1, 1240, 1239.6, 1237, 1231.4, 1233.1, 1233.4, 1236.6, 1237.1, 1229.3, 1227.6, 1217.5, 1219.2, 1220.4, 1222.3, 1226.2, 1224.9, 1222.8, 1221.9, 1221.8, 1226.4, 1226.4, 1225.2, 1226.8, 1229, 1227.3, 1230.8, 1234.1, 1235.1, 1234.9, 1229.9, 1231.3, 1229.2, 1234.6, 1232.4, 1233.8, 1232.6, 1234.6, 1239.6, 1240.9, 1239.3, 1241.1, 1241.4, 1247.2, 1244.8, 1244.4, 1245.7),
.Dim = c(1000L, 1L), index = structure(c(1451386800, 1451390400, 1451394000, 1451397600, 1451401200, 1451404800, 1451408400, 1451412000, 1451415600, 1451419200, 1451422800, 1451430000, 1451433600, 1451437200, 1451440800, 1451444400, 1451448000, 1451451600, 1451455200, 1451458800, 1451462400, 1451466000, 1451469600, 1451473200, 1451476800, 1451480400, 1451484000, 1451487600, 1451491200, 1451494800, 1451498400, 1451502000, 1451505600, 1451509200, 1451516400, 1451520000, 1451523600, 1451527200, 1451530800, 1451534400, 1451538000, 1451541600, 1451545200, 1451548800, 1451552400, 1451556000, 1451559600, 1451563200, 1451566800, 1451570400, 1451574000, 1451577600, 1451581200, 1451584800, 1451588400, 1451592000, 1451595600, 1451862000, 1451865600, 1451869200, 1451872800, 1451876400, 1451880000, 1451883600, 1451887200, 1451890800, 1451894400, 1451898000, 1451901600, 1451905200, 1451908800, 1451912400, 1451916000, 1451919600, 1451923200, 1451926800, 1451930400, 1451934000, 1451937600, 1451941200, 1451948400, 1451952000, 1451955600, 1451959200, 1451962800, 1451966400, 1451970000, 1451973600, 1451977200, 1451980800, 1451984400, 1451988000, 1451991600, 1451995200, 1451998800, 1452002400, 1452006000, 1452009600, 1452013200, 1452016800, 1452020400, 1452024000, 1452027600, 1452034800, 1452038400, 1452042000, 1452045600, 1452049200, 1452052800, 1452056400, 1452060000, 1452063600, 1452067200, 1452070800, 1452074400, 1452078000, 1452081600, 1452085200, 1452088800, 1452092400, 1452096000, 1452099600, 1452103200, 1452106800, 1452110400, 1452114000, 1452121200, 1452124800, 1452128400, 1452132000, 1452135600, 1452139200, 1452142800, 1452146400, 1452150000, 1452153600, 1452157200, 1452160800, 1452164400, 1452168000, 1452171600, 1452175200, 1452178800, 1452182400, 1452186000, 1452189600, 1452193200, 1452196800, 1452200400, 1452207600, 1452211200, 1452214800, 1452218400, 1452222000, 1452225600, 1452229200, 1452232800, 1452236400, 1452240000, 1452243600, 1452247200, 1452250800, 1452254400, 1452258000, 1452261600, 1452265200, 1452268800, 1452272400, 1452276000, 1452279600, 1452283200, 1452286800, 1452466800, 1452470400, 1452474000, 1452477600, 1452481200, 1452484800, 1452488400, 1452492000, 1452495600, 1452499200, 1452502800, 1452506400, 1452510000, 1452513600, 1452517200, 1452520800, 1452524400, 1452528000, 1452531600, 1452535200, 1452538800, 1452542400, 1452546000, 1452553200, 1452556800, 1452560400, 1452564000, 1452567600, 1452571200, 1452574800, 1452578400, 1452582000, 1452585600, 1452589200, 1452592800, 1452596400, 1452600000, 1452603600, 1452607200, 1452610800, 1452614400, 1452618000, 1452621600, 1452625200, 1452628800, 1452632400, 1452639600, 1452643200, 1452646800, 1452650400, 1452654000, 1452657600, 1452661200, 1452664800, 1452668400, 1452672000, 1452675600, 1452679200, 1452682800, 1452686400, 1452690000, 1452693600, 1452697200, 1452700800, 1452704400, 1452708000, 1452711600, 1452715200, 1452718800, 1452726000, 1452729600, 1452733200, 1452736800, 1452740400, 1452744000, 1452747600, 1452751200, 1452754800, 1452758400, 1452762000, 1452765600, 1452769200, 1452772800, 1452776400, 1452780000, 1452783600, 1452787200, 1452790800, 1452794400, 1452798000, 1452801600, 1452805200, 1452812400, 1452816000, 1452819600, 1452823200, 1452826800, 1452830400, 1452834000, 1452837600, 1452841200, 1452844800, 1452848400, 1452852000, 1452855600, 1452859200, 1452862800, 1452866400, 1452870000, 1452873600, 1452877200, 1452880800, 1452884400, 1452888000, 1452891600, 1453071600, 1453075200, 1453078800, 1453082400, 1453086000, 1453089600, 1453093200, 1453096800, 1453100400, 1453104000, 1453107600, 1453111200, 1453114800, 1453118400, 1453122000, 1453125600, 1453129200, 1453132800, 1453136400, 1453158000, 1453161600, 1453165200, 1453168800, 1453172400, 1453176000, 1453179600, 1453183200, 1453186800, 1453190400, 1453194000, 1453197600, 1453201200, 1453204800, 1453208400, 1453212000, 1453215600, 1453219200, 1453222800,
1453226400, 1453230000, 1453233600, 1453237200, 1453244400, 1453248000, 1453251600, 1453255200, 1453258800, 1453262400, 1453266000, 1453269600, 1453273200, 1453276800, 1453280400, 1453284000, 1453287600, 1453291200, 1453294800, 1453298400, 1453302000, 1453305600, 1453309200, 1453312800, 1453316400, 1453320000, 1453323600, 1453330800, 1453334400, 1453338000, 1453341600, 1453345200, 1453348800, 1453352400, 1453356000, 1453359600, 1453363200, 1453366800, 1453370400, 1453374000, 1453377600, 1453381200, 1453384800, 1453388400, 1453392000, 1453395600, 1453399200, 1453402800, 1453406400, 1453410000, 1453417200, 1453420800, 1453424400, 1453428000, 1453431600, 1453435200, 1453438800, 1453442400, 1453446000, 1453449600, 1453453200, 1453456800, 1453460400, 1453464000, 1453467600, 1453471200, 1453474800, 1453478400, 1453482000, 1453485600, 1453489200, 1453492800, 1453496400, 1453676400, 1453680000, 1453683600, 1453687200, 1453690800, 1453694400, 1453698000, 1453701600, 1453705200, 1453708800, 1453712400, 1453716000, 1453719600, 1453723200, 1453726800, 1453730400, 1453734000, 1453737600, 1453741200, 1453744800, 1453748400, 1453752000, 1453755600, 1453762800, 1453766400, 1453770000, 1453773600, 1453777200, 1453780800, 1453784400, 1453788000, 1453791600, 1453795200, 1453798800, 1453802400, 1453806000, 1453809600, 1453813200, 1453816800, 1453820400, 1453824000, 1453827600, 1453831200, 1453834800, 1453838400, 1453842000, 1453849200, 1453852800, 1453856400, 1453860000, 1453863600, 1453867200, 1453870800, 1453874400, 1453878000, 1453881600, 1453885200, 1453888800, 1453892400, 1453896000, 1453899600, 1453903200, 1453906800, 1453910400, 1453914000, 1453917600, 1453921200, 1453924800, 1453928400, 1453935600, 1453939200, 1453942800, 1453946400, 1453950000, 1453953600, 1453957200, 1453960800, 1453964400, 1453968000, 1453971600, 1453975200, 1453978800, 1453982400, 1453986000, 1453989600, 1453993200, 1453996800, 1454000400, 1454004000, 1454007600, 1454011200, 1454014800, 1454022000, 1454025600, 1454029200, 1454032800, 1454036400, 1454040000, 1454043600, 1454047200, 1454050800, 1454054400, 1454058000, 1454061600, 1454065200, 1454068800, 1454072400, 1454076000, 1454079600, 1454083200, 1454086800, 1454090400, 1454094000, 1454097600, 1454101200, 1454281200, 1454284800, 1454288400, 1454292000, 1454295600, 1454299200, 1454302800, 1454306400, 1454310000, 1454313600, 1454317200, 1454320800, 1454324400, 1454328000, 1454331600, 1454335200, 1454338800, 1454342400, 1454346000, 1454349600, 1454353200, 1454356800, 1454360400, 1454367600, 1454371200, 1454374800, 1454378400, 1454382000, 1454385600, 1454389200, 1454392800, 1454396400, 1454400000, 1454403600, 1454407200, 1454410800, 1454414400, 1454418000, 1454421600, 1454425200, 1454428800, 1454432400, 1454436000, 1454439600, 1454443200, 1454446800, 1454454000, 1454457600, 1454461200, 1454464800, 1454468400, 1454472000, 1454475600, 1454479200, 1454482800, 1454486400, 1454490000, 1454493600, 1454497200, 1454500800, 1454504400, 1454508000, 1454511600, 1454515200, 1454518800, 1454522400, 1454526000, 1454529600, 1454533200, 1454540400, 1454544000, 1454547600, 1454551200, 1454554800, 1454558400, 1454562000, 1454565600, 1454569200, 1454572800, 1454576400, 1454580000, 1454583600, 1454587200, 1454590800, 1454594400, 1454598000, 1454601600, 1454605200, 1454608800, 1454612400, 1454616000, 1454619600, 1454626800, 1454630400, 1454634000, 1454637600, 1454641200, 1454644800, 1454648400, 1454652000,
1454655600, 1454659200, 1454662800, 1454666400, 1454670000, 1454673600, 1454677200, 1454680800, 1454684400, 1454688000, 1454691600, 1454695200, 1454698800, 1454702400, 1454706000, 1454709600, 1454886000, 1454889600, 1454893200, 1454896800, 1454900400, 1454904000, 1454907600, 1454911200, 1454914800, 1454918400, 1454922000, 1454925600, 1454929200, 1454932800, 1454936400, 1454940000, 1454943600, 1454947200, 1454950800, 1454954400, 1454958000, 1454961600, 1454965200, 1454972400, 1454976000, 1454979600, 1454983200, 1454986800, 1454990400, 1454994000, 1454997600, 1455001200, 1455004800, 1455008400, 1455012000, 1455015600, 1455019200, 1455022800, 1455026400, 1455030000, 1455033600, 1455037200, 1455040800, 1455044400, 1455048000, 1455051600, 1455058800, 1455062400, 1455066000, 1455069600, 1455073200, 1455076800, 1455080400, 1455084000, 1455087600, 1455091200, 1455094800, 1455098400, 1455102000, 1455105600, 1455109200, 1455112800, 1455116400, 1455120000, 1455123600, 1455127200, 1455130800, 1455134400, 1455138000, 1455141600, 1455145200, 1455148800, 1455152400, 1455156000,
1455159600, 1455163200, 1455166800, 1455170400, 1455174000, 1455177600, 1455181200, 1455184800, 1455188400, 1455192000, 1455195600, 1455199200, 1455202800, 1455206400, 1455210000, 1455213600, 1455217200, 1455220800, 1455224400, 1455231600, 1455235200, 1455238800, 1455242400, 1455246000, 1455249600, 1455253200, 1455256800, 1455260400, 1455264000, 1455267600, 1455271200, 1455274800, 1455278400, 1455282000, 1455285600, 1455289200, 1455292800, 1455296400, 1455300000, 1455303600, 1455307200, 1455310800, 1455490800, 1455494400, 1455498000, 1455501600, 1455505200, 1455508800, 1455512400, 1455516000, 1455519600, 1455523200, 1455526800, 1455530400, 1455534000, 1455537600, 1455541200, 1455544800, 1455548400, 1455552000, 1455555600, 1455577200, 1455580800, 1455584400, 1455588000, 1455591600, 1455595200, 1455598800, 1455602400, 1455606000, 1455609600, 1455613200, 1455616800, 1455620400, 1455624000, 1455627600, 1455631200, 1455634800, 1455638400, 1455642000, 1455645600, 1455649200, 1455652800, 1455656400, 1455663600, 1455667200, 1455670800, 1455674400, 1455678000, 1455681600, 1455685200, 1455688800, 1455692400, 1455696000, 1455699600, 1455703200, 1455706800, 1455710400, 1455714000, 1455717600, 1455721200, 1455724800, 1455728400, 1455732000, 1455735600, 1455739200, 1455742800, 1455750000, 1455753600, 1455757200, 1455760800, 1455764400, 1455768000, 1455771600, 1455775200, 1455778800, 1455782400, 1455786000, 1455789600, 1455793200, 1455796800, 1455800400, 1455804000, 1455807600, 1455811200, 1455814800, 1455818400, 1455822000, 1455825600, 1455829200, 1455836400, 1455840000, 1455843600, 1455847200, 1455850800, 1455854400, 1455858000, 1455861600, 1455865200, 1455868800, 1455872400, 1455876000, 1455879600, 1455883200, 1455886800, 1455890400, 1455894000, 1455897600, 1455901200, 1455904800, 1455908400, 1455912000, 1455915600, 1456095600, 1456099200, 1456102800, 1456106400, 1456110000, 1456113600, 1456117200, 1456120800, 1456124400, 1456128000, 1456131600, 1456135200, 1456138800, 1456142400, 1456146000, 1456149600, 1456153200, 1456156800, 1456160400, 1456164000, 1456167600, 1456171200, 1456174800, 1456182000, 1456185600, 1456189200, 1456192800, 1456196400, 1456200000, 1456203600, 1456207200, 1456210800, 1456214400, 1456218000, 1456221600, 1456225200, 1456228800, 1456232400, 1456236000, 1456239600, 1456243200, 1456246800, 1456250400, 1456254000, 1456257600, 1456261200, 1456268400, 1456272000, 1456275600, 1456279200, 1456282800, 1456286400, 1456290000, 1456293600, 1456297200, 1456300800, 1456304400, 1456308000, 1456311600, 1456315200, 1456318800, 1456322400, 1456326000, 1456329600, 1456333200, 1456336800, 1456340400, 1456344000, 1456347600, 1456354800, 1456358400, 1456362000, 1456365600, 1456369200, 1456372800, 1456376400, 1456380000, 1456383600, 1456387200, 1456390800, 1456394400, 1456398000, 1456401600, 1456405200, 1456408800, 1456412400, 1456416000, 1456419600, 1456423200, 1456426800, 1456430400, 1456434000, 1456441200, 1456444800, 1456448400, 1456452000, 1456455600, 1456459200, 1456462800, 1456466400, 1456470000, 1456473600, 1456477200, 1456480800, 1456484400, 1456488000, 1456491600, 1456495200, 1456498800, 1456502400, 1456506000, 1456509600, 1456513200, 1456516800, 1456520400, 1456700400, 1456704000, 1456707600, 1456711200, 1456714800, 1456718400, 1456722000, 1456725600, 1456729200, 1456732800, 1456736400, 1456740000, 1456743600, 1456747200, 1456750800, 1456754400, 1456758000, 1456761600, 1456765200, 1456768800, 1456772400, 1456776000, 1456779600, 1456786800, 1456790400, 1456794000, 1456797600, 1456801200, 1456804800),
tzone = "", tclass = c("POSIXlt","POSIXt")), class = c("xts", "zoo"), .indexCLASS = c("POSIXlt", "POSIXt"), tclass = c("POSIXlt", "POSIXt"), .indexTZ = "", tzone = "", .CLASS = "double")
#THESE WORK AS INTENDED
SelectedDates <- DATSxts['2015-12-30::2015-12-31'] #get data between those dates
SelectedMonth <- DATSxts[.indexmon(DATSxts)==1] #get data for months February
SelectedDayYr <- DATSxts[.indexyday(DATSxts)==5] #get data for 5th trading days of the year
SelectedDayMon <- DATSxts[.indexmday(DATSxts)==10] #get data for 10th day of every month
SelectedDayWk <- DATSxts[.indexwday(DATSxts)==1] #get data for mondays
SelectedHour <- DATSxts[.indexhour(DATSxts)==08] #get data for 8AM
#THESE DO NOT WORK
SelectedYear <- DATSxts[.indexyear(DATSxts)==2016] #get data for year 2016
SelectedWeek <- DATSxts[.indexweek(DATSxts)==1] #get data for weeks 1
SelectedDay <- DATSxts[.indexday(DATSxts)==10] #get data for days 10
SelectedMin <- DATSxts[.indexmin(DATSxts)==30] #get data for every minute 30
****(Note: for some odd reason if I put all data/xts code in less than 8 lines loading the data gives an error message)****
You need to look at what .indexyear actually returns:
> .indexyear(DATSxts[1,])
[1] 115
> length( DATSxts[.indexyear(DATSxts)==116] )
[1] 943
> head( DATSxts[.indexyear(DATSxts)==116] )
[,1]
2016-01-03 15:00:00 1063.1
2016-01-03 16:00:00 1064.6
2016-01-03 17:00:00 1063.5
2016-01-03 18:00:00 1064.3
2016-01-03 19:00:00 1063.7
2016-01-03 20:00:00 1065.3
The 1900 basis is probably a holdover from an effort to emulate Excel on Windows. The weeks and days values are also different than you apparently expected:
> table( .indexweek(DATSxts) )
2400 2401 2402 2403 2404 2405 2406 2407 2408 2409
58 115 115 111 115 116 116 111 115 28
> table( .indexday(DATSxts) )
16798 16799 16800 16803 16804 16805 16806 16807 16808 16810 16811 16812 16813 16814
12 23 22 1 23 23 23 23 22 1 23 23 23 23
16815 16817 16818 16819 16820 16821 16822 16824 16825 16826 16827 16828 16829 16831
22 1 19 23 23 23 22 1 23 23 23 23 22 1
16832 16833 16834 16835 16836 16838 16839 16840 16841 16842 16843 16845 16846 16847
23 23 23 23 23 1 23 23 24 23 22 1 19 23
16848 16849 16850 16852 16853 16854 16855 16856 16857 16859 16860 16861
23 23 22 1 23 23 23 23 22 1 23 5
Granted, these aren't well-documented, but there are .index* functions that do what you want. A quick look at the source of a couple of the functions could have pointed you in the right direction. Take .indexyear for example, and note that ?POSIXlt says year is years since 1900.
R> .indexyear
function (x)
{
as.POSIXlt(.POSIXct(.index(x)))$year
}
<environment: namespace:xts>
SelectedYear <- DATSxts[(1900+.indexyear(DATSxts))==2016] #data for year 2016
Week of the year is not simple, and looking at the source would not have likely helped... There are several different ways to count the weeks in a year. See the "%U", "%V", and "%W" formats in ?strftime.
SelectedWeek <- DATSxts[strftime(index(DATSxts),"%W")=="00"] #get data for weeks 1
.indexday returns the day/date of the underlying index. Use .indexmday if you want the day of the month.
SelectedDay <- DATSxts[.indexmday(DATSxts)==10] #get data for days 10
I'm not sure what you expect .indexmin to do, since you do not have any data that occur on the 30th minute of any hour. The function below seems to be working as expected.
SelectedMin <- DATSxts[.indexmin(DATSxts)==30] #get data for every minute 30

Resources