Using row-wise column indices in a vector to extract values from data frame [duplicate]
Solution 1:
Just use matrix indexing, like this:
dframe[cbind(seq_along(i), i)]
# [1] "g" "b" "f"
The cbind(seq_along(i), i)
part creates a two column matrix of the relevant row and column that you want to extract.