i'm just getting started playing with some R.
A initial exercise was first to print the lynx
dataset:
> print(lynx)
Time Series:
Start = 1821
End = 1934
Frequency = 1
[1] 269 321 585 871 1475 2821 3928 5943 4950 2577 523 98 184 279 409 2285
[17] 2685 3409 1824 409 151 45 68 213 546 1033 2129 2536 957 361 377 225
[33] 360 731 1638 2725 2871 2119 684 299 236 245 552 1623 3311 6721 4254 687
[49] 255 473 358 784 1594 1676 2251 1426 756 299 201 229 469 736 2042 2811
[65] 4431 2511 389 73 39 49 59 188 377 1292 4031 3495 587 105 153 387
[81] 758 1307 3465 6991 6313 3794 1836 345 382 808 1388 2713 3800 3091 2985 3790
[97] 674 81 80 108 229 399 1132 2432 3574 2935 1537 529 485 662 1000 1590
[113] 2657 3396
And then I should order them in increasing order. I quickly find the order() function which looks like it does what it should (the correct answers also indicate this).
So I do this:
> print(order(lynx))
[1] 69 22 70 71 23 68 99 98 12 78 100 21 79 13 72 59 24 32 60 101
[21] 41 42 49 1 14 40 58 2 88 51 33 30 31 73 89 80 67 102 15 20
[41] 61 50 109 11 108 25 43 3 77 110 97 39 48 34 62 57 81 52 90 4
[61] 29 111 26 103 74 82 91 56 5 107 112 53 44 35 54 19 87 63 38 27
[81] 55 16 104 66 28 10 113 17 92 36 64 6 37 106 95 94 45 114 18 83
[101] 76 105 96 86 93 7 75 47 65 9 8 85 46 84
And this does something in rearranging the numbers, but it does'nt really look sorted at all. if we just take it from the start, it goes 69, then down to 22, and then up to 70. It does'nt seem sorted at all.
What does order do? if not sort?