Rolling apply with a custom function
The rollapply function from zoo allows you to apply any summary function to a rolling window. A summary function takes multiple numbers as input and returns a single number, like mean(), max(), sum(), etc.
Depending on the kind of data you have, you might need to write a function that combines multiple statistics, like in the example of our find_range() function in the video exercise.
In this exercise, you'll create a brief function that 'manually' calculates the mean value of a range of numbers, and apply it to a rolling window.
The dataset you'll work with, daily_temp, and the zoo and ggplot2 packages, are loaded for you.
यह अभ्यास पाठ्यक्रम का हिस्सा है
Manipulating Time Series Data in R
इंटरैक्टिव व्यावहारिक अभ्यास
हमारे इंटरैक्टिव अभ्यासों में से किसी एक के साथ सिद्धांत को व्यवहार में बदलें
अभ्यास शुरू करें