ExCellerate.Functions.General.Take (excellerate v0.4.0)

Copy Markdown View Source

Extracts rows, columns, or both from a list or 2D array.

Mimics the spreadsheet TAKE function. Positive counts take from the beginning; negative counts take from the end. Pass null to skip a dimension.

Examples

take(data, 3)           first 3 rows
take(data, -3)          last 3 rows
take(data, null, 2)     first 2 columns (all rows)
take(data, 3, 2)        first 3 rows, first 2 columns
take(data, -2, -2)      last 2 rows, last 2 columns