R script producing sequence of ordered couples