Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mat <- matrix(rnorm(35), 5, dimnames = list(seq(8, 16, 2), paste0("lag", 0:6)))
- # lag0 lag1 lag2 lag3 lag4 lag5 lag6
- # 8 0.4925472 0.2628757 -0.2749396 1.5804478 1.5730857 0.2128816 1.7490572
- # 10 -0.6017012 1.8896388 1.0942748 -1.5655523 1.1715792 -0.8381115 0.7584498
- # 12 -1.3818720 0.2558401 -0.1850495 0.1194266 -0.3610898 -0.7110094 0.5030568
- # 14 -1.0256927 1.1389601 -1.2203729 -0.4506702 0.8025542 0.5360424 0.6250335
- # 16 -0.8750509 -0.4706288 0.4423168 0.2678164 -0.6228561 -0.2462654 1.2823237
- mat[which.max(mat)]
- # 1.889639
- colnames(mat)[arrayInd(which.max(mat), dim(mat))[2]]
- # "lag1"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement