1
I have a table in csv with 5 information, two with dates, two with prices, and one with the difference between dates.
- I have date 1 fixed on a date and date 2 varying.
For example:
10/01/2018 > 11/01/2018
10/01/2018 > 12/01/2018
...
- I have the percentage of variation I picked up 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 that price. For example:
I have from day 10/01/2018 to day 11/01/2018, after day 10/01/2018 to day 12/01/2018.. From day 10 to day 11 is 1 day difference, from day 10 to day 12 are 2 days. I need to take the variation in the number of days of difference, but I’m not finding a way to do it in R. :(
PS: Illustrating how the result would be:
In differences of dates of 2 days the price varies by 10%, in 30 day date differences the price varies 5% and so on.
You can edit the question with the output of
dput(Tipo1)
or if the table is too large with the output ofdput(head(Tipo1, 20))
, please?– Rui Barradas