To begin, I am still pretty new to understand how R works. I know how to easily solve this question in Excel, but would like to know an equivalent solution method in R.

In R, I have a data frame with the below structure:

```
      Type      Type1      Type2     Type3     Type4     Type5
1        3  -9.697640 21.0876111 21.201925 20.306722 18.431434
2        4  -9.697640 21.0876111 21.201925 20.306722 18.431434
3        5  -9.697640 21.0876111 21.201925 20.306722 18.431434
4        1  -9.697640 21.0876111 21.201925 20.306722 18.431434
5        2  -9.697640 21.0876111 21.201925 20.306722 18.431434

```

My goal is simply to add a final column that uses `Type` to determine which of the other 5 columns to pull the value from. So for row 1, the value under `Type3` would be selected, while row 2 would select the value from `Type4`.

To do this in Excel I can simply use `=INDEX(B1:F1,A1)`. I've done this before using a loop in R, but would was hoping to find a more efficient method.