In R with RStudio, is there an approach to redirect the output from looping through a matrix into a data frame

If the following does not answer your question, please post your actual code as a Reproducible Example (Reprex)

MAT <- matrix(1:40, nrow = 8)
MAT
#>      [,1] [,2] [,3] [,4] [,5]
#> [1,]    1    9   17   25   33
#> [2,]    2   10   18   26   34
#> [3,]    3   11   19   27   35
#> [4,]    4   12   20   28   36
#> [5,]    5   13   21   29   37
#> [6,]    6   14   22   30   38
#> [7,]    7   15   23   31   39
#> [8,]    8   16   24   32   40
auc <- seq(1, 5, 2)
#with loop
Vals <- vector("numeric", length = length(auc))
for(i in seq_along(auc)) {
  Vals[i] <- MAT[2, auc[i]]
}
df <- as.data.frame(Vals)
df
#>   Vals
#> 1    2
#> 2   18
#> 3   34
 #without loop
Row2 = MAT[2, auc]
df2 <- as.data.frame(Row2)
df2
#>   Row2
#> 1    2
#> 2   18
#> 3   34

Created on 2019-07-10 by the reprex package (v0.2.1)