Dear helpers, I'm using plyr to process a large matrix for the first time. My code is set up to work with matrixes, since I learned the hard way that dataframes are considerably slower to process.
I started using aaply(), but the data was rearranged from a flat matrix to a [, , 4] array for larger input matrixes. I'm sure something clever is happening that I'm just not seeing - anyone have any insight? I can provide the code for index.frames() if you like, but it's pretty turgid stuff. For now I'm just using adply(), since it gives an output that I'd expect. Best toy.mat <- all.combinations[10:30,] > aaply(toy.mat,1, index.frames) Var1 1 2 3 4 46 3599.848 3665.454 12946.41 12946.41 51 3600.020 3666.424 12946.41 12946.41 56 3600.167 3667.301 12946.41 12946.41 61 3600.291 3668.058 12946.41 12946.41 66 3600.404 3668.766 12946.41 12946.41 71 3600.563 3669.779 12946.41 12946.41 76 3600.563 3669.779 12946.41 12946.41 81 3600.563 3669.779 12946.41 12946.41 86 3600.563 3669.779 12946.41 12946.41 91 3600.563 3669.779 12946.41 12946.41 96 3600.563 3669.779 12946.41 12946.41 101 3600.563 3669.779 12946.41 12946.41 106 3600.563 3669.779 12946.41 12946.41 111 3600.563 3669.779 12946.41 12946.41 116 3600.563 3669.779 12946.41 12946.41 121 3600.563 3669.779 12946.41 12946.41 126 3600.563 3669.779 12946.41 12946.41 131 3600.563 3669.779 12946.41 12946.41 136 3600.563 3669.779 12946.41 12946.41 141 3600.563 3669.779 12946.41 12946.41 146 3600.563 3669.779 12946.41 12946.41 > toy.mat <- all.combinations[10:100,] > aaply(toy.mat,1, index.frames, .progress="win") , , = 1 Var2 Var1 2 7 12 17 1 NA 3632.275 3630.730 3627.652 6 NA 3638.913 3638.271 3635.214 11 NA 3592.933 3593.322 3595.973 16 NA 3588.024 3588.232 3589.256 21 NA 3593.917 3594.088 3594.834 26 NA 3596.888 3597.051 3597.752 31 NA 3597.896 3598.056 3598.741 36 NA 3598.994 3599.153 3599.837 41 NA 3599.571 3599.729 3600.413 46 3599.848 3599.848 3600.006 3600.689 51 3600.020 3600.020 3600.178 NA 56 3600.167 3600.167 3600.325 NA 61 3600.291 3600.291 3600.448 NA 66 3600.404 3600.404 3600.561 NA 71 3600.563 3600.563 3600.721 NA 76 3600.563 3600.563 3600.721 NA 81 3600.563 3600.563 3600.721 NA 86 3600.563 3600.563 3600.721 NA 91 3600.563 3600.563 3600.721 NA 96 3600.563 3600.563 3600.721 NA 101 3600.563 3600.563 3600.721 NA 106 3600.563 3600.563 3600.721 NA 111 3600.563 3600.563 3600.721 NA 116 3600.563 3600.563 3600.721 NA 121 3600.563 3600.563 3600.721 NA 126 3600.563 3600.563 3600.721 NA 131 3600.563 3600.563 3600.721 NA 136 3600.563 3600.563 3600.721 NA 141 3600.563 3600.563 3600.721 NA 146 3600.563 3600.563 3600.721 NA , , = 2 Var2 Var1 2 7 12 17 1 NA 3681.001 3698.490 3688.247 6 NA 3664.453 3676.527 3666.970 11 NA 3662.162 3662.919 3668.211 16 NA 3661.484 3661.476 3661.975 21 NA 3648.731 3647.986 3650.290 26 NA 3649.497 3648.367 3653.130 31 NA 3652.778 3651.586 3656.638 36 NA 3660.082 3659.050 3662.755 41 NA 3663.944 3663.025 3665.933 46 3665.454 3665.454 3664.572 3667.226 51 3666.424 3666.424 3665.571 NA 56 3667.301 3667.301 3666.477 NA 61 3668.058 3668.058 3667.261 NA 66 3668.766 3668.766 3667.998 NA 71 3669.779 3669.779 3669.056 NA 76 3669.779 3669.779 3669.056 NA 81 3669.779 3669.779 3669.056 NA 86 3669.779 3669.779 3669.056 NA 91 3669.779 3669.779 3669.056 NA 96 3669.779 3669.779 3669.056 NA 101 3669.779 3669.779 3669.056 NA 106 3669.779 3669.779 3669.056 NA 111 3669.779 3669.779 3669.056 NA 116 3669.779 3669.779 3669.056 NA 121 3669.779 3669.779 3669.056 NA 126 3669.779 3669.779 3669.056 NA 131 3669.779 3669.779 3669.056 NA 136 3669.779 3669.779 3669.056 NA 141 3669.779 3669.779 3669.056 NA 146 3669.779 3669.779 3669.056 NA , , = 3 Var2 Var1 2 7 12 17 1 NA 12946.41 12946.41 12946.41 6 NA 12946.41 12946.41 12946.41 11 NA 12946.41 12946.41 12946.41 16 NA 12946.41 12946.41 12946.41 21 NA 12946.41 12946.41 12946.41 26 NA 12946.41 12946.41 12946.41 31 NA 12946.41 12946.41 12946.41 36 NA 12946.41 12946.41 12946.41 41 NA 12946.41 12946.41 12946.41 46 12946.41 12946.41 12946.41 12946.41 51 12946.41 12946.41 12946.41 NA 56 12946.41 12946.41 12946.41 NA 61 12946.41 12946.41 12946.41 NA 66 12946.41 12946.41 12946.41 NA 71 12946.41 12946.41 12946.41 NA 76 12946.41 12946.41 12946.41 NA 81 12946.41 12946.41 12946.41 NA 86 12946.41 12946.41 12946.41 NA 91 12946.41 12946.41 12946.41 NA 96 12946.41 12946.41 12946.41 NA 101 12946.41 12946.41 12946.41 NA 106 12946.41 12946.41 12946.41 NA 111 12946.41 12946.41 12946.41 NA 116 12946.41 12946.41 12946.41 NA 121 12946.41 12946.41 12946.41 NA 126 12946.41 12946.41 12946.41 NA 131 12946.41 12946.41 12946.41 NA 136 12946.41 12946.41 12946.41 NA 141 12946.41 12946.41 12946.41 NA 146 12946.41 12946.41 12946.41 NA , , = 4 Var2 Var1 2 7 12 17 1 NA 12946.41 12946.41 12946.41 6 NA 12946.41 12946.41 12946.41 11 NA 12946.41 12946.41 12946.41 16 NA 12946.41 12946.41 12946.41 21 NA 12946.41 12946.41 12946.41 26 NA 12946.41 12946.41 12946.41 31 NA 12946.41 12946.41 12946.41 36 NA 12946.41 12946.41 12946.41 41 NA 12946.41 12946.41 12946.41 46 12946.41 12946.41 12946.41 12946.41 51 12946.41 12946.41 12946.41 NA 56 12946.41 12946.41 12946.41 NA 61 12946.41 12946.41 12946.41 NA 66 12946.41 12946.41 12946.41 NA 71 12946.41 12946.41 12946.41 NA 76 12946.41 12946.41 12946.41 NA 81 12946.41 12946.41 12946.41 NA 86 12946.41 12946.41 12946.41 NA 91 12946.41 12946.41 12946.41 NA 96 12946.41 12946.41 12946.41 NA 101 12946.41 12946.41 12946.41 NA 106 12946.41 12946.41 12946.41 NA 111 12946.41 12946.41 12946.41 NA 116 12946.41 12946.41 12946.41 NA 121 12946.41 12946.41 12946.41 NA 126 12946.41 12946.41 12946.41 NA 131 12946.41 12946.41 12946.41 NA 136 12946.41 12946.41 12946.41 NA 141 12946.41 12946.41 12946.41 NA 146 12946.41 12946.41 12946.41 NA > toy.mat Var1 Var2 Var3 Var4 Var5 10 46 2 3 4 5 11 51 2 3 4 5 12 56 2 3 4 5 13 61 2 3 4 5 14 66 2 3 4 5 15 71 2 3 4 5 16 76 2 3 4 5 17 81 2 3 4 5 18 86 2 3 4 5 19 91 2 3 4 5 20 96 2 3 4 5 21 101 2 3 4 5 22 106 2 3 4 5 23 111 2 3 4 5 24 116 2 3 4 5 25 121 2 3 4 5 26 126 2 3 4 5 27 131 2 3 4 5 28 136 2 3 4 5 29 141 2 3 4 5 30 146 2 3 4 5 31 1 7 3 4 5 32 6 7 3 4 5 33 11 7 3 4 5 34 16 7 3 4 5 35 21 7 3 4 5 36 26 7 3 4 5 37 31 7 3 4 5 38 36 7 3 4 5 39 41 7 3 4 5 40 46 7 3 4 5 41 51 7 3 4 5 42 56 7 3 4 5 43 61 7 3 4 5 44 66 7 3 4 5 45 71 7 3 4 5 46 76 7 3 4 5 47 81 7 3 4 5 48 86 7 3 4 5 49 91 7 3 4 5 50 96 7 3 4 5 51 101 7 3 4 5 52 106 7 3 4 5 53 111 7 3 4 5 54 116 7 3 4 5 55 121 7 3 4 5 56 126 7 3 4 5 57 131 7 3 4 5 58 136 7 3 4 5 59 141 7 3 4 5 60 146 7 3 4 5 61 1 12 3 4 5 62 6 12 3 4 5 63 11 12 3 4 5 64 16 12 3 4 5 65 21 12 3 4 5 66 26 12 3 4 5 67 31 12 3 4 5 68 36 12 3 4 5 69 41 12 3 4 5 70 46 12 3 4 5 71 51 12 3 4 5 72 56 12 3 4 5 73 61 12 3 4 5 74 66 12 3 4 5 75 71 12 3 4 5 76 76 12 3 4 5 77 81 12 3 4 5 78 86 12 3 4 5 79 91 12 3 4 5 80 96 12 3 4 5 81 101 12 3 4 5 82 106 12 3 4 5 83 111 12 3 4 5 84 116 12 3 4 5 85 121 12 3 4 5 86 126 12 3 4 5 87 131 12 3 4 5 88 136 12 3 4 5 89 141 12 3 4 5 90 146 12 3 4 5 91 1 17 3 4 5 92 6 17 3 4 5 93 11 17 3 4 5 94 16 17 3 4 5 95 21 17 3 4 5 96 26 17 3 4 5 97 31 17 3 4 5 98 36 17 3 4 5 99 41 17 3 4 5 100 46 17 3 4 5 > Ben Caldwell [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.