[R] One year return not year to date

Pedro páramo percent||101 @end|ng |rom gm@||@com
Sat Jul 25 12:10:58 CEST 2020


Hi all,

I want to calculate interanual (not year to date) variation of a stock, I
am able to obtain year to date with annualReturn, but no way to obtain the
interanual increase. It says me no numerical output.

Can anyone guide me to obtain it.

library(PerformanceAnalytics)
library(dplyr)
library(tibble)
library(lubridate)
library(PerformanceAnalytics)
library(quantmod)
library(ggplot2)
library(png)
library(RCurl)

fecha<-Sys.Date()-365 #with this I obtain one year back beginning
precio<-getSymbols("ACX.MC",from='fecha')
ret2<- na.omit(CalculateReturns(Cl(ACX.MC)))
g<-annualReturn(ACX.MC) #This is year to date
d<-CalculateReturns(Cl(ACX.MCC))
aaa<-getQuote('ACX.MC',from='fecha')
Lastprice<-aaa[1,2]

lo<-c(diff(log(aaa),250))  #With this I try  to obtain interanual year
variation but error


Hope you can help me

	[[alternative HTML version deleted]]



More information about the R-help mailing list