Jump to content

Averages/Simple moving average: Difference between revisions

m
→‎{{header|R}}: it's not a moving average as explained by the wikipedia page
(Added R code)
m (→‎{{header|R}}: it's not a moving average as explained by the wikipedia page)
Line 389:
 
=={{header|R}}==
{{incorrect|R|Values shouldn't be just accumulated indefinitely: the older is sent away by the arriving of the new one, according to a given period, i.e. max number of values that are kept; check the link in the task for details}}
This is easiest done with two functions: one to handle the state (i.e. the numbers already entered), and one to calculate the average.
<lang R>
Cookies help us deliver our services. By using our services, you agree to our use of cookies.