# Rolling

This function returns the computed value of a data series within a time window or a given number of values, using one of the following aggregation methods: "mean", "sum", "min", "max", or "count".

The rolling function has the following syntax:

**rolling(<variable>, <aggregation_method> , <type_of_range>, <range> , min periods = 2)**

Parameter | Description | Value | Mandatory |
---|---|---|---|

variable | It shows the measurements of a sensor as a time series of data points that vary over time, also known as "dots", and is identified by a variable label. | variable label | YES |

aggregation_method | Function where the elements of a time series are computed to return a single summary value. | $mean$ , $sum$ , $min$ , $max$ , $count$ | YES |

type of range | Indicates whether a date range or a set number of elements are used to sample the time series. | $window$ or $values$ | YES |

range | A time window or a set of elements that will be computed by the function. NOTE: The selected range for a "window" should be set in a way that evenly divide the next range. For example, if using minutes ("T"), whatever the number n is, it has to evenly divide an hour ("H"). Available values for minutes are: 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30. Other values may render unexpected results. Same applies to other ranges. | Available data ranges: positive Integer, fixed number of observations used for each window or a time range specified as follows: $"nT"$ : Every n minutes$"nH"$ : Every n hours$"nD"$ : Every n days | YES |

Min periods | Number of values needed to calculate the mobile aggregation, by default it is set in 2 which is the minimum required. | `min_periods = n` , where n is a positive integer. | NO |

Last modified 6mo ago