0

For a given sequence, how can I fetch rows of certain row numbers(indices). I know that nth() can select the nth index. But what if I want to select multiple rows by index ?

r.expr([0, 10, 20, 30, 40, 50]).nth(3)    // gives 30

The above works. But, how do I get the following ?

r.expr([0, 10, 20, 30, 40, 50]).nth([3, 5, 2])    // gives [30, 50, 20]

1 Answers1

0

You may be better using slice:

selection.slice(startOffset[, endOffset, {leftBound:'closed', rightBound:'open'}]) → selection

The docs are here.

alex
  • 5,467
  • 4
  • 33
  • 43