[R] How to select one value per row (different columns) from array

Wolfgang Waser waser at frankenfoerder-fg.de
Wed Mar 1 14:28:32 CET 2017


Dear all,

I have to pick one value per row from an array, but from row to row from
a different column. The column positions of the values for each row are
stored in a vector.

array: 999 rows, 48 columns

vector: 999 values (each between 1 and 48) indicating for each row which
value to pick from that row.

Is there a non-loop way to pick the 999 values from the array, probably
using some form of ?apply?


Thank you very much for help and suggestions!

Wolfgang



More information about the R-help mailing list