get_sort_var function

Get a vector from a vector/list/table to be used in mapping