Skip to content
Prev 139584 / 398506 Next

How to loop through all the columns in dataframe

Is this what you were looking for:
+ c(2.2024,2.4216,1.4672,1.4817,1.4957,1.4431,1.5676)
+ c(0.017046,0.018504,0.012157,0.012253,0.012348,0.011997,0.012825)
[,1]        [,2]        [,3]        [,4]       [,5]
[,6]       [,7]
xd 2.20240e+00 2.42160e+00 1.46720e+00 1.48170e+00 1.4957e+00
1.4431e+00 1.5676e+00
pd 1.70460e-02 1.85040e-02 1.21570e-02 1.22530e-02 1.2348e-02
1.1997e-02 1.2825e-02
td 1.60524e+05 1.63565e+05 1.43973e+05 1.11956e+05 8.9677e+04
9.5269e+04 8.1558e+04
+     t(varA + trans[, .col[1]] * covAB + trans[, .col + 1] * covAB +
trans[, .col[1]] * trans[, .col + 1] * varB)
+ })
xd           pd        td
 [1,] 3.827555e-07 3.562187e-06 13817.642
 [2,] 5.216407e-07 3.570411e-06 12162.524
 [3,] 5.195306e-07 3.570286e-06  9457.751
 [4,] 5.174933e-07 3.570163e-06  7575.638
 [5,] 5.251477e-07 3.570618e-06  8048.046
 [6,] 5.070304e-07 3.569545e-06  6889.751
 [7,] 4.049294e-07 3.568518e-06 12392.937
 [8,] 4.044920e-07 3.568394e-06  9636.924
 [9,] 4.040698e-07 3.568271e-06  7719.154
[10,] 4.056562e-07 3.568725e-06  8200.512
[11,] 4.019013e-07 3.567653e-06  7020.273
[12,] 9.053716e-07 3.576633e-06  8482.585
[13,] 8.979174e-07 3.576510e-06  6794.531
[14,] 9.259239e-07 3.576965e-06  7218.231
[15,] 8.596348e-07 3.575891e-06  6179.364
[16,] 8.904145e-07 3.576385e-06  5283.524
[17,] 9.180195e-07 3.576841e-06  5612.999
[18,] 8.526806e-07 3.575766e-06  4805.162
[19,] 9.103878e-07 3.576717e-06  4495.999
[20,] 8.459661e-07 3.575643e-06  3848.924
[21,] 8.711933e-07 3.576098e-06  4088.938

        
On 3/15/08, Felipe Carrillo <mazatlanmexico at yahoo.com> wrote: