could not read the data you posted; try 'dput' next time.

If it is just a 2 day moving average, try the 'filter' function:

> x <- 1:20
> x
 [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20
> filter(x, c(.5,.5))
Time Series:
Start = 1
End = 20
Frequency = 1
 [1]  1.5  2.5  3.5  4.5  5.5  6.5  7.5  8.5  9.5 10.5 11.5 12.5 13.5 14.5
15.5 16.5 17.5 18.5 19.5   NA
>



Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.

On Sun, Dec 28, 2014 at 6:56 AM, Rolf Edberg <ro...@algonet.se> wrote:

>
>
> How do I add a new column with 2-days moving average (from
> r-adamant(https://github.com/TotallyBullshit/radamant)) on IBM prices in a
> csv-file (ibm.csv) and then save all in a new csv file(ibm2.csv)?
>
>
>
>
> Prices
>
>
>
>
>
> Date
>
> Open
>
> High
>
> Low
>
> Close
>
> Volume
>
> Adj Close*
>
>
> Dec 26, 2014
>
> 162.27
>
> 163.09
>
> 162.01
>
> 162.34
>
> 1,912,200
>
> 162.34
>
>
> Dec 24, 2014
>
> 162.88
>
> 162.99
>
> 161.61
>
> 161.82
>
> 1,868,100
>
> 161.82
>
>
> Dec 23, 2014
>
> 162.23
>
> 162.90
>
> 161.61
>
> 162.24
>
> 4,043,300
>
> 162.24
>
>
> Dec 22, 2014
>
> 158.33
>
> 161.91
>
> 158.33
>
> 161.44
>
> 4,682,500
>
> 161.44
>
>
> Dec 19, 2014
>
> 157.49
>
> 160.41
>
> 157.49
>
> 158.51
>
> 8,864,900
>
> 158.51
>
>
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to