Skip to main content
Version: Java (Groovy)

slicePct

The slicePct method returns a table that that is a subset of another table corresponding to the difference between the start and end row percentages. For example, for a table of size 10, slicePct(0.1, 0.7) will return a subset from the second row to the seventh row. Similarly, slicePct(0, 1) would return the entire table (because row positions run from 0 to size - 1). If the percentage arguments are outisde of the range [0, 1], an error will occur.

caution

Attempting to use slicePct on a blink table will raise an error.

Syntax

table.slicePct(startPercentInclusive, endPercentExclusive)

Parameters

ParameterTypeDescription
startPercentInclusivedouble

The starting percentage point (inclusive) for rows to include in the result. The percentage arguments must be in the range [0.0, 1.0].

endPercentExclusivedouble

The ending percentage point (exclusive) for rows to include in the result. The percentage arguments must be in the range [0, 1].

Returns

A new table that is a subset of the source table.

Example

The following example filters the table to a subset between the tenth and 70th rows.

source = emptyTable(100).update("X = i")
result = source.slicePct(0.1, 0.7)