Sort TSV function for R