I have a table in csv with 5 information, two with dates, two with prices, and one with the difference between dates.
- I have the date 1 set to a date and the date 2 varies.
For example:
10/01/2018 > 11/01/2018
10/01/2018 > 1/12/2018
...
- I have the percentage of variation that I got through the script below:
Tipo1_X <- (sd(Tipo1$precoin, na.rm = T)/mean(Tipo1$precoin, na.rm = T))*100
Tipo2_X <- (sd(Tipo2$precoin, na.rm = T)/mean(Tipo2$precoin, na.rm = T))*100
Tipo3_X <- (sd(Tipo3$precoin, na.rm = T)/mean(Tipo3$precoin, na.rm = T))*100
Tipo1_XX <- (sd(Tipo1$precoout, na.rm = T)/mean(Tipo1$precoout, na.rm = T))*100
Tipo2_XX <- (sd(Tipo2$precoout, na.rm = T)/mean(Tipo2$precoout, na.rm = T))*100
Tipo3_XX <- (sd(Tipo3$precoout, na.rm = T)/mean(Tipo3$precoout, na.rm = T))*100
- Now, I need to know the variation of days in relation to this price. For example:
I have from 10/01/2018 to 11/01/2018, after the 10/01/2018 to the 12/01/2018 .. From the 10th to the 11th is a day difference of the day 10 to day 12 is 2 days. I need to get the variation on the number of days of the difference, but I can not find a way to do this in R.: (
PS: Exemplifying what the result would look like:
In differences of dates of 2 days the price varies by 10%, in 30-day date differences the price varies by 5%, and so on.