Documentation

sample() function

Flux 0.7.0+

The sample() function selects a subset of the records from the input table. sample() is a selector function.

sample(n:5, pos: -1)

Empty tables

sample() drops empty tables.

Parameters

n

(Required) Sample every Nth element.

pos

Position offset from the start of results where sampling begins. pos must be less than n. If pos is less than 0, a random offset is used. Default is -1 (random offset).

tables

Input data. Default is piped-forward data (<-).

Examples

The following example uses data provided by the sampledata package to show how sample() transforms data.

import "sampledata"

sampledata.int()
  |> sample(n: 2, pos: 1)

View input and output


Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.