I have data that comes to me with many similar variables, with an additional variable which indicates which one of those similar variables I really want. Using a loop I
I noticed this answer from @josliber see (https://stackoverflow.com/a/30279903/4606130) when trying to work on a data.table solution and it seems fast: