これらの Python リスト内包表記に相当する R は次のとおりです。
[(i,j) for i,j in zip(index, Values)]
[(i,j) for i,j in enumerate(Values)]
[(i,j) for i,j in enumerate(range(10,20))] %MWE, indexing or enumerating to
%keep up with the index, there may
%be some parameter to look this up
出力例
>>> [(i,j) for i,j in enumerate(range(10,20))]
[(0, 10), (1, 11), (2, 12), (3, 13), (4, 14), (5, 15), (6, 16), (7, 17), (8, 18), (9, 19)]
私は以前にRでいくつかのトリックでこの問題を解決しましたが、もう思い出せません。最初のアイデアは itertools -pkg でしたが、もっと慣用的な方法を見つけたいと思っています。